Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVeronika Irvine2001-06-21 15:16:50 +0000
committerVeronika Irvine2001-06-21 15:16:50 +0000
commit6c0e3d76ce668620fd159ac504e2b5d9a48852be (patch)
tree28ec743469ad12010dec20832bd1d5c1a3d72d8a /bundles
parent3fb799dcaa7d449679ed92f9829fbed85aa6fd1d (diff)
downloadeclipse.platform.swt-6c0e3d76ce668620fd159ac504e2b5d9a48852be.tar.gz
eclipse.platform.swt-6c0e3d76ce668620fd159ac504e2b5d9a48852be.tar.xz
eclipse.platform.swt-6c0e3d76ce668620fd159ac504e2b5d9a48852be.zip
Diffstat (limited to 'bundles')
-rwxr-xr-xbundles/org.eclipse.swt/.classpath_motif2
-rwxr-xr-xbundles/org.eclipse.swt/.classpath_photon14
-rwxr-xr-xbundles/org.eclipse.swt/.classpath_win3232
-rwxr-xr-xbundles/org.eclipse.swt/.cvsignore3
-rwxr-xr-xbundles/org.eclipse.swt/.vcm_meta6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT AWT/win32/org/eclipse/swt/internal/awt/win32/SWT_AWT.java12
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT AWT/win32/org/eclipse/swt/internal/awt/win32/package.html6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/AnimatedProgress.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/BusyIndicator.java36
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CCombo.java124
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CLabel.java36
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder.java328
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolderAdapter.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolderEvent.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolderListener.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabItem.java19
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/ControlEditor.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/DefaultContent.java77
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/DefaultLineStyler.java46
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/ExtendedModifyEvent.java7
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/ExtendedModifyListener.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/LineBackgroundEvent.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/LineBackgroundListener.java7
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/LineStyleEvent.java7
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/LineStyleListener.java7
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/PopupList.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/ST.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/SashForm.java21
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/ScrolledComposite.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StackLayout.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyleRange.java7
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledText.java311
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledTextContent.java52
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledTextEvent.java9
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledTextListener.java19
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledTextPrinter.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/TableEditor.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/TableTree.java13
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/TableTreeEditor.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/TableTreeItem.java13
-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.java24
-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.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/VerifyKeyListener.java7
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/ViewForm.java28
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/close.gifbin0 -> 839 bytes
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/left.gifbin0 -> 828 bytes
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/leftDisabled.gifbin0 -> 828 bytes
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/package.html5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/right.gifbin0 -> 828 bytes
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/rightDisabled.gifbin0 -> 828 bytes
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DND.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DNDEvent.java7
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DNDListener.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DragSourceAdapter.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DragSourceEvent.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DragSourceListener.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DragUnderEffect.java10
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DropTargetAdapter.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DropTargetEvent.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DropTargetListener.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/NoDragUnderEffect.java10
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/package.html4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/ByteArrayTransfer.java20
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/Clipboard.java18
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/DragSource.java238
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/DropTarget.java197
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/FileTransfer.java40
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/RTFTransfer.java41
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/TableDragUnderEffect.java12
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/TextTransfer.java42
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/Transfer.java45
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/TransferData.java23
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/TreeDragUnderEffect.java36
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/ByteArrayTransfer.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/Clipboard.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/DragSource.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/DropTarget.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/FileTransfer.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/RTFTransfer.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/TableDragUnderEffect.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/TextTransfer.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/Transfer.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/TransferData.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/TreeDragUnderEffect.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/ByteArrayTransfer.java34
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/Clipboard.java16
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/DragSource.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/DropTarget.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/FileTransfer.java38
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/OleEnumFORMATETC.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/RTFTransfer.java38
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TableDragUnderEffect.java12
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TextTransfer.java39
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/Transfer.java40
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TransferData.java23
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TreeDragUnderEffect.java36
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/CAUUID.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/COM.java8
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/COMObject.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/CONTROLINFO.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/COSERVERINFO.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/DISPPARAMS.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/DROPFILES.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/DVTARGETDEVICE.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/EXCEPINFO.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/FORMATETC.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/FUNCDESC1.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/FUNCDESC2.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/GUID.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IClassFactory2.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IConnectionPoint.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IConnectionPointContainer.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IDataObject.java9
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IDispatch.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IEnum.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IEnumFORMATETC.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IEnumSTATSTG.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IFont.java9
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IMoniker.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IOleCommandTarget.java9
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IOleControl.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IOleInPlaceActiveObject.java9
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IOleInPlaceObject.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IOleLink.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IOleObject.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IOleWindow.java9
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IPersist.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IPersistStorage.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IProvideClassInfo.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IProvideClassInfo2.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/ISpecifyPropertyPages.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IStorage.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IStream.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/ITypeInfo.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IUnknown.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IViewObject2.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/LICINFO.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/OLECMD.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/OLECMDTEXT.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/OLEINPLACEFRAMEINFO.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/STATSTG.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/STGMEDIUM.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/TYPEATTR.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/VARDESC1.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/VARDESC2.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/package.html11
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OLE.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleAutomation.java18
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleClientSite.java33
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleControlSite.java9
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleEvent.java8
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleEventSink.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleEventTable.java7
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleFile.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleFrame.java88
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleFunctionDescription.java10
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleListener.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleParameterDescription.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OlePropertyChangeSink.java10
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OlePropertyDescription.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/Variant.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/package.html10
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Printing/common/org/eclipse/swt/printing/PrinterData.java7
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Printing/common/org/eclipse/swt/printing/package.html4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Printing/motif/org/eclipse/swt/printing/PrintDialog.java142
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Printing/motif/org/eclipse/swt/printing/Printer.java233
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Printing/photon/org/eclipse/swt/printing/PrintDialog.java56
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Printing/photon/org/eclipse/swt/printing/Printer.java86
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Printing/win32/org/eclipse/swt/printing/PrintDialog.java7
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Printing/win32/org/eclipse/swt/printing/Printer.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Program/common/org/eclipse/swt/program/package.html5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Program/motif/org/eclipse/swt/program/Program.java18
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Program/photon/org/eclipse/swt/program/Program.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Program/win32/org/eclipse/swt/program/Program.java23
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/library/callback.c5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/library/callback.h5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/library/globals.c5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/library/globals.h5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/library/library.h5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/SWT.java50
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/SWTError.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/SWTException.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/SWTMessages.properties16
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/ArmEvent.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/ArmListener.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/ControlAdapter.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/ControlEvent.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/ControlListener.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/DisposeEvent.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/DisposeListener.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/FocusAdapter.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/FocusEvent.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/FocusListener.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/HelpEvent.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/HelpListener.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/KeyAdapter.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/KeyEvent.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/KeyListener.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/MenuAdapter.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/MenuEvent.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/MenuListener.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/ModifyEvent.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/ModifyListener.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/MouseAdapter.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/MouseEvent.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/MouseListener.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/MouseMoveListener.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/MouseTrackAdapter.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/MouseTrackListener.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/PaintEvent.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/PaintListener.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/SelectionAdapter.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/SelectionEvent.java11
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/SelectionListener.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/ShellAdapter.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/ShellEvent.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/ShellListener.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/TraverseEvent.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/TraverseListener.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/TreeAdapter.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/TreeEvent.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/TreeListener.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/TypedEvent.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/VerifyEvent.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/VerifyListener.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/Drawable.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/ImageData.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/ImageLoader.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/ImageLoaderEvent.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/ImageLoaderListener.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/PaletteData.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/Point.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/RGB.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/Rectangle.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/Callback.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/FileFormat.java7
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/GIFFileFormat.java7
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/JPEGAppn.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/JPEGArithmeticConditioningTable.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/JPEGComment.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/JPEGEndOfImage.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/JPEGFileFormat.java7
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/JPEGFixedSizeSegment.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/JPEGFrameHeader.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/JPEGHuffmanTable.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/JPEGQuantizationTable.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/JPEGRestartInterval.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/JPEGScanHeader.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/JPEGSegment.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/JPEGStartOfImage.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/JPEGVariableSizeSegment.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/LEDataInputStream.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/LEDataOutputStream.java7
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/LZWCodec.java7
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/LZWNode.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PNGFileFormat.java26
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngChunk.java12
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngChunkReader.java10
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngDecodingDataStream.java14
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngFileReadState.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngHuffmanTable.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngHuffmanTables.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngIdatChunk.java10
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngIendChunk.java10
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngIhdrChunk.java12
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngLzBlockReader.java18
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngPlteChunk.java12
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngTrnsChunk.java10
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/WinBMPFileFormat.java7
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/WinICOFileFormat.java7
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/layout/FillLayout.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/layout/GridData.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/layout/GridLayout.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/layout/RowData.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/layout/RowLayout.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/layout/package.html4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/widgets/Dialog.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/widgets/Event.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/widgets/EventTable.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/widgets/Item.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/widgets/Layout.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/widgets/Listener.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/widgets/RunnableLock.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/widgets/Synchronizer.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/widgets/TypedListener.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/version.txt1
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/library/build.csh17
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/library/gnome.c5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/library/kde.cc5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/library/library.c5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/library/make_linux.mak7
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/library/structs.c5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/library/structs.h6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/library/swt.c192
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/Color.java163
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/Cursor.java136
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/Device.java326
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/DeviceData.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/Font.java212
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/FontData.java166
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/FontMetrics.java73
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/GC.java924
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/GCData.java19
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/Image.java371
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/Region.java193
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/Converter.java19
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/GNOME.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/KDE.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/OS.java39
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/Visual.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XAnyEvent.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XButtonEvent.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XCharStruct.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XColor.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XConfigureEvent.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XCrossingEvent.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XEvent.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XExposeEvent.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XFocusChangeEvent.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XFontStruct.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XGCValues.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XImage.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XInputEvent.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XKeyEvent.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XMotionEvent.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XRectangle.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XSetWindowAttributes.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XWindowAttributes.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XWindowChanges.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XWindowEvent.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XmAnyCallbackStruct.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XmDragProcCallback.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XmDropFinishCallback.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XmDropProcCallback.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XmTextBlockRec.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XmTextVerifyCallbackStruct.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XtWidgetGeometry.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/AbstractTreeItem.java23
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Button.java397
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Canvas.java174
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Caret.java430
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/ColorDialog.java114
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Combo.java1030
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Composite.java157
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Control.java1699
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/CoolBar.java194
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/CoolItem.java164
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Decorations.java326
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/DirectoryDialog.java111
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Display.java819
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/FileDialog.java25
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/FontDialog.java74
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/FontExtStyle.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/FontExtStyles.java7
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Group.java99
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Header.java10
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Label.java393
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/List.java1323
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Menu.java598
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/MenuItem.java549
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/MessageBox.java71
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/ProgressBar.java218
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Sash.java139
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Scale.java351
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/ScrollBar.java657
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Scrollable.java111
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/SelectableItem.java24
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/SelectableItemWidget.java48
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Shell.java442
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Slider.java460
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/TabFolder.java256
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/TabItem.java158
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Table.java871
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/TableColumn.java328
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/TableItem.java288
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Text.java1148
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/ToolBar.java209
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/ToolDrawable.java7
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/ToolItem.java852
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Tracker.java145
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Tree.java416
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/TreeItem.java272
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/TreeRoots.java19
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Widget.java514
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/WidgetTable.java8
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/library/build.sh7
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/library/library.c5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/library/makefile.mak7
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/library/structs.c113
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/library/structs.h33
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/library/swt.c483
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/graphics/Color.java11
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/graphics/Cursor.java110
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/graphics/Device.java55
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/graphics/DeviceData.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/graphics/Font.java12
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/graphics/FontData.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/graphics/FontMetrics.java7
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/graphics/GC.java239
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/graphics/GCData.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/graphics/Image.java21
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/graphics/Region.java27
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/Converter.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/FontDetails.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/FontQueryInfo.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/OS.java108
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PgAlpha_t.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PgMap_t.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PhArea_t.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PhCursorDef_t.java36
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PhCursorInfo_t.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PhDim_t.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PhEvent_t.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PhImage_t.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PhKeyEvent_t.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PhPoint_t.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PhPointerEvent_t.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PhRect_t.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PhRegion_t.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PhTile_t.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PhWindowEvent_t.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PtCallbackInfo_t.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PtColorSelectInfo_t.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PtContainerCallback_t.java22
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PtFileSelectionInfo_t.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PtScrollbarCallback_t.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PtTextCallback_t.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PtTreeItem_t.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/AbstractTreeItem.java23
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Button.java59
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Canvas.java41
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Caret.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/ColorDialog.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Combo.java53
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Composite.java145
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Control.java533
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Decorations.java30
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/DirectoryDialog.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Display.java252
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/FileDialog.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/FontDialog.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Group.java7
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Header.java10
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Label.java189
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/List.java81
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Menu.java58
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/MenuItem.java216
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/MessageBox.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/ProgressBar.java7
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Sash.java26
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Scale.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/ScrollBar.java26
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Scrollable.java14
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/SelectableItem.java24
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/SelectableItemWidget.java48
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Shell.java268
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Slider.java7
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/TabFolder.java12
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/TabItem.java12
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Table.java872
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/TableColumn.java328
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/TableItem.java288
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Text.java124
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/ToolBar.java24
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/ToolItem.java155
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Tracker.java155
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Tree.java420
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/TreeItem.java272
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/TreeRoots.java19
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Widget.java122
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/WidgetTable.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/library/build.bat3
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/library/library.c5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/library/makefile.mak6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/library/structs.c5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/library/structs.h5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/library/swt.c73
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/library/swt.rc13
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/library/swtole.c37
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Color.java25
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Cursor.java15
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Device.java64
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/DeviceData.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Font.java20
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/FontData.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/FontMetrics.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/GC.java273
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/GCData.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java35
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Region.java47
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/Converter.java7
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/ACCEL.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/BITMAP.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/BROWSEINFO.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/CHOOSECOLOR.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/CHOOSEFONT.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/COMPOSITIONFORM.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/CREATESTRUCT.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/DIBSECTION.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/DLLVERSIONINFO.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/DOCINFO.java7
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/DRAWITEMSTRUCT.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/HDITEM.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/HELPINFO.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/ICONINFO.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/INITCOMMONCONTROLSEX.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/LOGBRUSH.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/LOGFONT.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/LOGPEN.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/LRESULT.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/LVCOLUMN.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/LVHITTESTINFO.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/LVITEM.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/MEASUREITEMSTRUCT.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/MENUINFO.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/MENUITEMINFO.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/MSG.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/NMHDR.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/NMHEADER.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/NMLISTVIEW.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/NMTOOLBAR.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/NMTTDISPINFO.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/OPENFILENAME.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/OS.java60
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/PAINTSTRUCT.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/POINT.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/PRINTDLG.java7
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/REBARBANDINFO.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/RECT.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/SCROLLINFO.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/SIZE.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/TBBUTTON.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/TBBUTTONINFO.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/TCITEM.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/TEXTMETRIC.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/TOOLINFO.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/TRACKMOUSEEVENT.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/TVHITTESTINFO.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/TVINSERTSTRUCT.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/TVITEM.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/WINDOWPLACEMENT.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/WINDOWPOS.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/WNDCLASSEX.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Button.java21
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Canvas.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Caret.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ColorDialog.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Combo.java17
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Composite.java8
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java36
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/CoolBar.java16
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/CoolItem.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Decorations.java31
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/DirectoryDialog.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java44
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/FileDialog.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/FontDialog.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Group.java8
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ImageList.java14
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Label.java42
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/List.java129
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Menu.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/MenuItem.java20
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/MessageBox.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ProgressBar.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Sash.java10
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Scale.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ScrollBar.java17
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Scrollable.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Shell.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Slider.java23
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TabFolder.java26
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TabItem.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java140
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TableColumn.java17
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TableItem.java12
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Text.java131
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolBar.java69
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolItem.java89
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tracker.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java74
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TreeItem.java14
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Widget.java13
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/WidgetTable.java4
-rwxr-xr-xbundles/org.eclipse.swt/build.properties.common8
-rwxr-xr-xbundles/org.eclipse.swt/build.properties.motif5
-rwxr-xr-xbundles/org.eclipse.swt/build.properties.photon5
-rwxr-xr-xbundles/org.eclipse.swt/build.properties.win327
-rwxr-xr-xbundles/org.eclipse.swt/buildnotes_swt.html1173
-rwxr-xr-xbundles/org.eclipse.swt/plugin.jars7
-rwxr-xr-xbundles/org.eclipse.swt/plugin.xml15
-rwxr-xr-xbundles/org.eclipse.swt/readme_swt.html102
-rwxr-xr-xbundles/org.eclipse.swt/ws/motif/libXm.so.2.1bin0 -> 1915756 bytes
-rwxr-xr-xbundles/org.eclipse.swt/ws/motif/libswt-gnome0125.sobin0 -> 4713 bytes
-rwxr-xr-xbundles/org.eclipse.swt/ws/motif/libswt0125.sobin0 -> 366199 bytes
-rwxr-xr-xbundles/org.eclipse.swt/ws/photon/libswt0125.sobin0 -> 385634 bytes
-rwxr-xr-xbundles/org.eclipse.swt/ws/win32/swt0125.dllbin0 -> 237568 bytes
599 files changed, 23971 insertions, 9912 deletions
diff --git a/bundles/org.eclipse.swt/.classpath_motif b/bundles/org.eclipse.swt/.classpath_motif
index 54824b8739..9446ffe549 100755
--- a/bundles/org.eclipse.swt/.classpath_motif
+++ b/bundles/org.eclipse.swt/.classpath_motif
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="lib" path="/bluebird/teamswt/swt-builddir/jre/lib/rt.jar"/>
+ <classpathentry kind="var" path="JRE_LIB"/>
<classpathentry kind="src" path="Eclipse SWT/motif"/>
<classpathentry kind="src" path="Eclipse SWT/common"/>
<classpathentry kind="src" path="Eclipse SWT Printing/motif"/>
diff --git a/bundles/org.eclipse.swt/.classpath_photon b/bundles/org.eclipse.swt/.classpath_photon
new file mode 100755
index 0000000000..c061bdbf30
--- /dev/null
+++ b/bundles/org.eclipse.swt/.classpath_photon
@@ -0,0 +1,14 @@
+<?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/common"/>
+ <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="output" path="bin"/>
+</classpath>
diff --git a/bundles/org.eclipse.swt/.classpath_win32 b/bundles/org.eclipse.swt/.classpath_win32
index 6cd92d2205..a743829e7a 100755
--- a/bundles/org.eclipse.swt/.classpath_win32
+++ b/bundles/org.eclipse.swt/.classpath_win32
@@ -1,16 +1,16 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="lib" path="J:\teamswt\swt-builddir\jre\lib\rt.jar"/>
- <classpathentry kind="src" path="Eclipse SWT\win32"/>
- <classpathentry kind="src" path="Eclipse SWT\common"/>
- <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 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="bin\Eclipse SWT"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
+<?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 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="output" path="bin"/>
+</classpath>
diff --git a/bundles/org.eclipse.swt/.cvsignore b/bundles/org.eclipse.swt/.cvsignore
index 43e9b71b6f..30e8e7346e 100755
--- a/bundles/org.eclipse.swt/.cvsignore
+++ b/bundles/org.eclipse.swt/.cvsignore
@@ -1,2 +1,3 @@
bin
-.classpath \ No newline at end of file
+.classpath
+build.properties \ No newline at end of file
diff --git a/bundles/org.eclipse.swt/.vcm_meta b/bundles/org.eclipse.swt/.vcm_meta
index aae2e1b3ef..67f905f685 100755
--- a/bundles/org.eclipse.swt/.vcm_meta
+++ b/bundles/org.eclipse.swt/.vcm_meta
@@ -1,6 +1,12 @@
<?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
index 5573ac6a09..d6777ad621 100755
--- 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
@@ -1,5 +1,10 @@
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;
@@ -21,11 +26,6 @@ import java.awt.Dimension;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
-/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
- */
-
public class SWT_AWT {
public static Panel new_Panel (final Composite parent) {
@@ -64,4 +64,4 @@ public static Shell new_Shell (Display display, final Canvas parent) {
shell.setVisible (true);
return shell;
}
-} \ No newline at end of file
+}
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
index 2f36647b51..14ccb40f0e 100755
--- 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
@@ -5,9 +5,11 @@
<title>Package-level Javadoc</title>
</head>
<body>
-Brief overview will be provided here.
+SWT experimental AWT embedding support
<h2>
Package Specification</h2>
-Detailed overview will be provided here.
+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
index af654766de..efdb04a943 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.custom;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
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
index d97f8be1f7..404ff4793f 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.custom;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.*;
@@ -15,9 +15,10 @@ import org.eclipse.swt.widgets.*;
*/
public class BusyIndicator {
- static int[] counts = new int[0];
static Display[] displays = new Display[0];
static Cursor[] cursors = new Cursor[0];
+ static int nextBusyId = 1;
+ static final String BUSYID_NAME = "SWT BusyIndicator";
/**
* Runs the given <code>Runnable</code> while providing
@@ -57,37 +58,37 @@ public static void showWhile(Display display, Runnable runnable) {
}
});
- int[] newCounts = new int[counts.length + 1];
- System.arraycopy(counts, 0, newCounts, 0, counts.length);
- counts = newCounts;
-
Cursor[] newCursors = new Cursor[cursors.length + 1];
System.arraycopy(cursors, 0, newCursors, 0, cursors.length);
cursors = newCursors;
}
- if (counts[index] == 0) {
+ if (cursors[index] == null) {
cursors[index] = new Cursor(display, SWT.CURSOR_WAIT);
}
- counts[index]++;
+ Integer busyId = new Integer(nextBusyId);
+ nextBusyId = (++nextBusyId) % 65536;
Shell[] shells = display.getShells();
for (int i = 0; i < shells.length; i++) {
- shells[i].setCursor(cursors[index]);
+ Integer id = (Integer)shells[i].getData(BUSYID_NAME);
+ if (id == null) {
+ shells[i].setCursor(cursors[index]);
+ shells[i].setData(BUSYID_NAME, busyId);
+ }
}
try {
runnable.run();
} finally {
- counts[index]--;
- if (counts[index] == 0) {
- shells = display.getShells();
- for (int i = 0; i < shells.length; i++) {
+ 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);
}
- cursors[index].dispose();
- cursors[index] = null;
}
}
}
@@ -105,7 +106,6 @@ static void clear(Display display) {
cursors[index].dispose();
}
cursors[index] = null;
- counts[index] = 0;
displays[index] = null;
}
-} \ No newline at end of file
+}
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
index f263e2b2fd..ca80b50924 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.custom;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.*;
@@ -15,6 +15,9 @@ import org.eclipse.swt.widgets.*;
* 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>
@@ -30,6 +33,7 @@ public final class CCombo extends Composite {
List list;
Shell popup;
Button arrow;
+ boolean hasFocus;
public CCombo (Composite parent, int style) {
super (parent, checkStyle (style));
@@ -41,7 +45,7 @@ public CCombo (Composite parent, int style) {
if ((style & SWT.FLAT) != 0) textStyle |= SWT.FLAT;
text = new Text (this, textStyle);
- popup = new Shell (getShell (), SWT.ON_TOP | SWT.NO_TRIM);
+ popup = new Shell (getShell (), SWT.NO_TRIM);
int listStyle = SWT.SINGLE | SWT.V_SCROLL;
if ((style & SWT.FLAT) != 0) listStyle |= SWT.FLAT;
@@ -77,16 +81,16 @@ public CCombo (Composite parent, int style) {
}
};
- int [] popupEvents = {SWT.Close, SWT.Paint, SWT.Deactivate};
+ int [] popupEvents = {SWT.Close, SWT.Paint, SWT.Activate, 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.FocusIn, SWT.FocusOut, SWT.Traverse};
+ int [] textEvents = {SWT.KeyDown, SWT.KeyUp, SWT.Modify, SWT.MouseDown, SWT.MouseUp, SWT.Traverse};
for (int i=0; i<textEvents.length; i++) text.addListener (textEvents [i], listener);
- int [] listEvents = {SWT.MouseUp, SWT.FocusIn, SWT.FocusOut, SWT.Selection};
+ int [] listEvents = {SWT.MouseUp, SWT.Selection};
for (int i=0; i<listEvents.length; i++) list.addListener (listEvents [i], listener);
- int [] comboEvents = {SWT.Dispose, SWT.Move, SWT.Resize};
+ int [] comboEvents = {SWT.Dispose, SWT.Move, SWT.Resize, SWT.Activate, SWT.Deactivate};
for (int i=0; i<comboEvents.length; i++) this.addListener (comboEvents [i], listener);
int [] arrowEvents = {SWT.MouseDown};
@@ -214,6 +218,24 @@ void comboEvent (Event event) {
case SWT.Resize:
internalLayout();
break;
+ case SWT.Activate: {
+ if (hasFocus) return;
+ hasFocus = true;
+ if (getEditable ()) text.selectAll ();
+ Event e = new Event();
+ e.time = event.time;
+ notifyListeners(SWT.FocusIn, e);
+ break;
+ }
+ case SWT.Deactivate: {
+ Control focusControl = getDisplay ().getFocusControl();
+ if (focusControl == list) return;
+ hasFocus = false;
+ Event e = new Event();
+ e.time = event.time;
+ notifyListeners(SWT.FocusOut, e);
+ break;
+ }
}
}
@@ -267,6 +289,7 @@ void dropDown (boolean drop) {
if (drop == isDropped ()) return;
if (!drop) {
popup.setVisible (false);
+ text.setFocus();
return;
}
int index = list.getSelectionIndex ();
@@ -484,12 +507,19 @@ public int indexOf (String string, int 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;
-
- if (isDropped ()) dropDown (false);
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);
@@ -524,22 +554,6 @@ void listEvent (Event event) {
event.doit = e.doit;
break;
}
- case SWT.FocusOut: {
- Control control = getDisplay ().getFocusControl ();
- if (control == text) return;
- Event e = new Event();
- e.time = event.time;
- notifyListeners(SWT.FocusOut, e);
- break;
- }
- case SWT.FocusIn: {
- Control control = getDisplay ().getFocusControl ();
- if (control == text) return;
- Event e = new Event();
- e.time = event.time;
- notifyListeners(SWT.FocusIn, e);
- break;
- }
}
}
void popupEvent(Event event) {
@@ -555,6 +569,14 @@ void popupEvent(Event event) {
event.doit = false;
dropDown (false);
break;
+ case SWT.Activate:
+ if (hasFocus) return;
+ hasFocus = true;
+ if (getEditable ()) text.selectAll ();
+ Event e = new Event();
+ e.time = event.time;
+ notifyListeners(SWT.FocusIn, e);
+ break;
case SWT.Deactivate:
dropDown (false);
break;
@@ -847,6 +869,16 @@ public void setText (String string) {
public void setTextLimit (int limit) {
text.setTextLimit (limit);
}
+public void setVisible (boolean visible) {
+ super.setVisible(visible);
+ if (!getVisible()) {
+ Composite parent = getParent();
+ while (parent != null && !parent.isVisible()) {
+ parent = parent.getParent();
+ }
+ if (parent != null) parent.setFocus();
+ }
+}
void textEvent (Event event) {
switch (event.type) {
case SWT.KeyDown: {
@@ -911,31 +943,25 @@ void textEvent (Event event) {
text.selectAll ();
break;
}
- case SWT.FocusIn: {
- if (getEditable ()) text.selectAll ();
- Event e = new Event();
- e.time = event.time;
- notifyListeners(SWT.FocusIn, e);
- break;
- }
- case SWT.FocusOut: {
- Display display = getDisplay ();
- Control focusControl = display.getFocusControl ();
- if (isDropped ()) {
- Control cursorControl = display.getCursorControl ();
- if (cursorControl != list) dropDown (false);
- if (focusControl != text) dropDown (false);
- }
- if (focusControl == list) return;
- Event e = new Event();
- e.time = event.time;
- notifyListeners(SWT.FocusOut, e);
- break;
- }
case SWT.Traverse: {
- if (event.detail == SWT.TRAVERSE_ARROW_PREVIOUS || event.detail == SWT.TRAVERSE_ARROW_NEXT) {
- event.doit = false;
+ switch (event.detail) {
+ case SWT.TRAVERSE_RETURN:
+ case SWT.TRAVERSE_TAB_NEXT:
+ // allow "return" and "tab" to have their usual effect
+ break;
+ case SWT.TRAVERSE_ESCAPE:
+ // escape key is used to close the list so
+ // do not use it for traversal
+ event.doit = false;
+ break;
+ case SWT.TRAVERSE_ARROW_PREVIOUS:
+ case SWT.TRAVERSE_ARROW_NEXT:
+ // 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;
@@ -947,4 +973,4 @@ void textEvent (Event event) {
}
}
}
-} \ No newline at end of file
+}
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
index c2c372db5f..0afada598c 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.custom;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.*;
@@ -245,8 +245,13 @@ private void onPaint(PaintEvent event) {
// draw a background image behind the text
if (backgroundImage != null) {
Rectangle imageRect = backgroundImage.getBounds();
- gc.drawImage(backgroundImage, 0, 0, imageRect.width, imageRect.height,
- 0, 0, rect.width, rect.height);
+ try {
+ gc.drawImage(backgroundImage, 0, 0, imageRect.width, imageRect.height,
+ 0, 0, rect.width, rect.height);
+ } catch(SWTException e) {
+ gc.setBackground(getBackground());
+ gc.fillRectangle(rect);
+ }
} else {
gc.setBackground(getBackground());
gc.fillRectangle(rect);
@@ -350,23 +355,29 @@ public void setBackground(Color[] colors, int[] percents) {
// Draw gradient onto an image
if (colors != null) {
+ Color[] colorsCopy = null;
+ Display display = getDisplay();
+ if (display.getDepth() < 15) {
+ colorsCopy = new Color[]{colors[0]};
+ } else {
+ colorsCopy = colors;
+ }
+
int x = 0; int y = 0;
int width = 100; int height = 10;
-
- Display display = getDisplay();
Image temp = new Image(display, width, height);
GC gc = new GC(temp);
- if (colors.length == 1) {
- gc.setBackground(colors[0]);
+ if (colorsCopy.length == 1) {
+ gc.setBackground(colorsCopy[0]);
gc.fillRectangle(temp.getBounds());
}
int start = 0;
int end = 0;
- for (int j = 0; j < colors.length - 1; j++) {
- Color startColor = colors[j];
+ for (int j = 0; j < colorsCopy.length - 1; j++) {
+ Color startColor = colorsCopy[j];
if (startColor == null) startColor = getBackground();
RGB rgb1 = startColor.getRGB();
- Color endColor = colors[j+1];
+ Color endColor = colorsCopy[j+1];
if (endColor == null) endColor = getBackground();
RGB rgb2 = endColor.getRGB();
start = end;
@@ -388,7 +399,7 @@ public void setBackground(Color[] colors, int[] percents) {
}
gc.dispose();
gradientImage = temp;
- gradientColors = colors;
+ gradientColors = colorsCopy;
gradientPercents = percents;
backgroundImage = temp;
}
@@ -440,6 +451,7 @@ public void setText(String text) {
* 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;
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
index 4c4f90cbb8..2d10a97655 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.custom;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.*;
@@ -11,6 +11,30 @@ 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 {
@@ -84,12 +108,11 @@ public class CTabFolder extends Composite {
// close button
boolean showClose = false;
+ private Image closeImage;
ToolBar closeBar;
private ToolItem closeItem;
- private Image closeImage;
private ToolBar inactiveCloseBar;
private ToolItem inactiveCloseItem;
- private Image inactiveCloseImage;
private CTabItem inactiveItem;
private boolean shortenedTabs = false;
@@ -132,28 +155,27 @@ public CTabFolder(Composite parent, int style) {
borderColor1 = new Color(getDisplay(), borderInsideRGB);
borderColor2 = new Color(getDisplay(), borderMiddleRGB);
borderColor3 = new Color(getDisplay(), borderOutsideRGB);
- Color foreground = getForeground();
Color background = getBackground();
// create scrolling arrow buttons
scrollBar = new ToolBar(this, SWT.FLAT);
scrollBar.setVisible(false);
+ scrollBar.setBackground(background);
scrollLeft = new ToolItem(scrollBar, SWT.PUSH);
scrollLeft.setEnabled(false);
scrollRight = new ToolItem(scrollBar, SWT.PUSH);
scrollRight.setEnabled(false);
- initScrollButtons(foreground, background);
// create close buttons
closeBar = new ToolBar(this, SWT.FLAT);
closeBar.setVisible(false);
+ closeBar.setBackground(background);
closeItem = new ToolItem(closeBar, SWT.PUSH);
- initCloseButton(foreground, background);
inactiveCloseBar = new ToolBar(this, SWT.FLAT);
inactiveCloseBar.setVisible(false);
+ inactiveCloseBar.setBackground(background);
inactiveCloseItem = new ToolItem(inactiveCloseBar, SWT.PUSH);
- initInactiveCloseButton(foreground, background);
Listener listener = new Listener() {
public void handleEvent(Event event) {
@@ -176,27 +198,46 @@ public CTabFolder(Composite parent, int style) {
// tool tip support
Display display = getDisplay();
- tip = new Shell (getShell(), SWT.NONE);
- tip.setLayout(new FillLayout());
+ 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());
+
addMouseTrackListener (new MouseTrackAdapter () {
public void mouseExit(MouseEvent e) {
+ if (tip.isDisposed()) return;
if (tip.isVisible()) tip.setVisible(false);
}
public void mouseHover(MouseEvent e) {
+ if (tip.isDisposed()) return;
Point pt = new Point (e.x, e.y);
CTabItem item = getItem(pt);
if (item != null) {
String tooltip = item.getToolTipText();
if (tooltip != null) {
- pt.y = (onBottom) ? pt.y - 26 : pt.y + 26;
- pt = toDisplay(pt);
- tip.setLocation(pt);
+
Label label = (Label) (tip.getChildren() [0]);
- label.setText(tooltip);
+ 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;
}
@@ -238,16 +279,19 @@ public void addSelectionListener(SelectionListener listener) {
addListener(SWT.Selection, typedListener);
addListener(SWT.DefaultSelection, typedListener);
}
-/**
-* Adds the listener to receive events.
-* <p>
-*
-* @param listener the listener
-*
-* @exception SWTError <ul>
-* <li>ERROR_NULL_ARGUMENT when listener is null</li>
-* </ul>
-*/
+/**
+ * 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
@@ -256,8 +300,11 @@ public void addCTabFolderListener(CTabFolderListener listener) {
tabListeners = newTabListeners;
tabListeners[tabListeners.length - 1] = listener;
showClose = true;
+ initCloseButtonImages();
}
private void closeNotify(CTabItem item, int time) {
+ if (item == null) return;
+
CTabFolderEvent event = new CTabFolderEvent(this);
event.widget = this;
event.time = time;
@@ -445,11 +492,6 @@ private void onDispose() {
closeImage = null;
}
- if (inactiveCloseImage != null) {
- inactiveCloseImage.dispose();
- inactiveCloseImage = null;
- }
-
if (borderColor1 != null) {
borderColor1.dispose();
borderColor1 = null;
@@ -691,6 +733,7 @@ private void layoutButtons() {
boolean rightVisible = scroll_rightVisible();
if (leftVisible || rightVisible) {
+ initScrollBarImages();
Point size = scrollBar.getSize();
Rectangle area = super.getClientArea();
int x = area.x + area.width - size.x - BORDER_RIGHT;
@@ -736,8 +779,6 @@ private void layoutItems() {
if (isDisposed()) return;
Rectangle area = super.getClientArea();
- if (area.height == 0) return;
-
int tabHeight = getTabHeight();
shortenedTabs = false;
@@ -912,8 +953,9 @@ private void redrawTabArea(int index) {
CTabItem item = items[index];
x = item.x;
y = item.y;
- width = item.width;
- height = item.height;
+ Rectangle area = super.getClientArea();
+ width = area.x + area.width - x;
+ height = area.y + area.height - y;
}
redraw(x, y, width, height, false);
}
@@ -982,10 +1024,10 @@ private void onResize() {
layoutItems();
redraw();
} else {
- if (onBottom && oldArea.height != area.height) {
+ if (onBottom && oldArea.height != area.height){
// move tabs up or down if tabs on bottom
layoutItems();
- redraw();
+ redraw();
} else {
int width = 0;
if (oldArea.width < area.width) {
@@ -1006,11 +1048,8 @@ private void onResize() {
if (oldArea.width != area.width) {
// resize the widths so that all tabs are visible
- boolean wasShortened = shortenedTabs;
layoutItems();
- if (wasShortened || shortenedTabs) {
- redrawTabArea(-1);
- }
+ redrawTabArea(-1);
}
}
}
@@ -1030,17 +1069,14 @@ public void setBackground (Color color) {
Color foreground = getForeground();
// init inactive close button
- initInactiveCloseButton(foreground, color);
+ inactiveCloseBar.setBackground(color);
// init scroll buttons
- initScrollButtons(foreground, color);
+ scrollBar.setBackground(color);
// init close button
if (gradientColors == null) {
- if (selectionForeground != null) {
- foreground = selectionForeground;
- }
- initCloseButton(foreground, color);
+ closeBar.setBackground(color);
}
}
/**
@@ -1114,24 +1150,30 @@ public void setSelectionBackground(Color[] colors, int[] percents) {
// Draw gradient onto an image
if (colors != null) {
+ Color[] colorsCopy = null;
+ Display display = getDisplay();
+ if (display.getDepth() < 15) {
+ colorsCopy = new Color[]{colors[0]};
+ } else {
+ colorsCopy = colors;
+ }
+
int x = 0; int y = 0;
int width = 100; int height = 10;
-
- Display display = getDisplay();
Image temp = new Image(display, width, height);
GC gc = new GC(temp);
int start = 0;
int end = 0;
Color background = getBackground();
- if (colors.length == 1) {
- gc.setBackground(colors[0]);
+ if (colorsCopy.length == 1) {
+ gc.setBackground(colorsCopy[0]);
gc.fillRectangle(temp.getBounds());
}
- for (int j = 0; j < colors.length - 1; j++) {
- Color startColor = colors[j];
+ for (int j = 0; j < colorsCopy.length - 1; j++) {
+ Color startColor = colorsCopy[j];
if (startColor == null) startColor = getBackground();
RGB rgb1 = startColor.getRGB();
- Color endColor = colors[j+1];
+ Color endColor = colorsCopy[j+1];
if (endColor == null) endColor = getBackground();
RGB rgb2 = endColor.getRGB();
start = end;
@@ -1153,20 +1195,17 @@ public void setSelectionBackground(Color[] colors, int[] percents) {
}
gc.dispose();
gradientImage = temp;
- gradientColors = colors;
+ gradientColors = colorsCopy;
gradientPercents = percents;
backgroundImage = temp;
- Color closeBackground = colors[colors.length - 1];
- if (closeBackground == null){
+ Color closeBackground = colorsCopy[colorsCopy.length - 1];
+ if (closeBackground == null || display.getDepth() < 15){
closeBackground = background;
}
- Color closeForeground = getForeground();
- initCloseButton(closeForeground, closeBackground);
+ closeBar.setBackground(closeBackground);
} else {
- Color closeBackground = getBackground();
- Color closeForeground = getForeground();
- initCloseButton(closeForeground, closeBackground);
+ closeBar.setBackground(getBackground());
}
if (selectedIndex > -1) redrawTabArea(selectedIndex);
}
@@ -1204,19 +1243,6 @@ public void setFont(Font font) {
layoutItems();
redrawTabArea(-1);
}
-public void setForeground (Color color) {
- super.setForeground(color);
- color = getForeground();
- Color background = getBackground();
-
- initInactiveCloseButton(color, background);
- initScrollButtons(color, background);
-
- if (gradientColors != null) {
- background = gradientColors[gradientColors.length - 1];
- }
- initCloseButton(color, background);
-}
public void setSelectionForeground (Color color) {
if (selectionForeground == color) return;
if (color == null) color = getForeground();
@@ -1331,98 +1357,90 @@ private void setSelectionNotify(int index) {
}
}
-private void initCloseButton(Color foreground, Color background) {
- if (closeImage != null) {
- closeImage.dispose();
+private void initCloseButtonImages() {
+ if (closeImage != null) return;
+
+ try {
+ Display display = getDisplay();
+ Image image = new Image(display, CTabFolder.class.getResourceAsStream("close.gif"));
+ ImageData source = image.getImageData();
+ ImageData mask = source.getTransparencyMask();
+ image.dispose();
+ closeImage = new Image(display, source, mask);
+ } catch (Error e) {
closeImage = null;
+ return;
}
- closeImage = drawCloseImage(foreground, background);
- closeBar.setBackground(background);
- closeBar.setForeground(foreground);
+
+ closeItem.setDisabledImage(closeImage);
closeItem.setImage(closeImage);
+ inactiveCloseItem.setDisabledImage(closeImage);
+ inactiveCloseItem.setImage(closeImage);
+
+ int height = getTabHeight();
+ Point size = closeBar.computeSize(SWT.DEFAULT, height);
+ closeBar.setSize(size);
+ inactiveCloseBar.setSize(size);
}
-private void initInactiveCloseButton(Color foreground, Color background) {
- if (inactiveCloseImage != null) {
- inactiveCloseImage.dispose();
- inactiveCloseImage = null;
- }
- inactiveCloseImage = drawCloseImage(foreground, background);
- inactiveCloseBar.setBackground(background);
- inactiveCloseBar.setForeground(foreground);
- inactiveCloseItem.setImage(inactiveCloseImage);
-}
-private Image drawCloseImage(Color foreground, Color background) {
- Image image = new Image(getDisplay(), 9, 9);
- GC gc = new GC(image);
- gc.setBackground(background);
- gc.fillRectangle(0, 0, 9, 9);
- gc.setForeground(foreground);
- for (int i = 0; i < 8; i++) {
- gc.drawLine(i, i, i + 1, i);
- gc.drawLine(7 - i, i, 8 - i, i);
- }
- gc.dispose();
- return image;
-}
-private void initScrollButtons(Color foreground, Color background) {
+private void initScrollBarImages() {
+ if (arrowLeftImage != null) return;
- scrollBar.setBackground(background);
-
- Display display = getDisplay();
- Color shadow = display.getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW);
- if (arrowLeftImage != null) {
- arrowLeftImage.dispose();
- arrowLeftImage = null;
- }
- if (arrowLeftDisabledImage != null) {
- arrowLeftDisabledImage.dispose();
- arrowLeftDisabledImage = null;
+ try {
+ Display display = getDisplay();
+ Image image = new Image(display, CTabFolder.class.getResourceAsStream("leftDisabled.gif"));
+ ImageData source = image.getImageData();
+ ImageData mask = source.getTransparencyMask();
+ image.dispose();
+ arrowLeftDisabledImage = new Image(display, source, mask);
+
+ image = new Image(display, CTabFolder.class.getResourceAsStream("left.gif"));
+ source = image.getImageData();
+ mask = source.getTransparencyMask();
+ image.dispose();
+ arrowLeftImage = new Image(display, source, mask);
+
+ image = new Image(display, CTabFolder.class.getResourceAsStream("rightDisabled.gif"));
+ source = image.getImageData();
+ mask = source.getTransparencyMask();
+ image.dispose();
+ arrowRightDisabledImage = new Image(display, source, mask);
+
+ image = new Image(display, CTabFolder.class.getResourceAsStream("right.gif"));
+ source = image.getImageData();
+ mask = source.getTransparencyMask();
+ image.dispose();
+ arrowRightImage = new Image(display, source, mask);
+ } catch (Error e) {
+ if (arrowLeftDisabledImage != null){
+ arrowLeftDisabledImage.dispose();
+ arrowLeftDisabledImage = null;
+ }
+ if (arrowLeftImage != null){
+ arrowLeftImage.dispose();
+ arrowLeftImage = null;
+ }
+ if (arrowRightDisabledImage != null){
+ arrowRightDisabledImage.dispose();
+ arrowRightDisabledImage = null;
+ }
+ if (arrowRightImage != null){
+ arrowRightImage.dispose();
+ arrowRightImage = null;
+ }
+ return;
}
- arrowLeftImage = drawArrowImage(foreground, background, true);
- arrowLeftDisabledImage = drawArrowImage(shadow, background, true);
- scrollLeft.setImage(arrowLeftImage);
+
scrollLeft.setDisabledImage(arrowLeftDisabledImage);
- scrollLeft.setHotImage(arrowLeftImage);
+ scrollLeft.setImage(arrowLeftImage);
- if (arrowRightImage != null) {
- arrowRightImage.dispose();
- arrowRightImage = null;
- }
- if (arrowRightDisabledImage != null) {
- arrowRightDisabledImage.dispose();
- arrowRightDisabledImage = null;
- }
- arrowRightImage = drawArrowImage(foreground, background, false);
- arrowRightDisabledImage = drawArrowImage(shadow, background, false);
- scrollRight.setImage(arrowRightImage);
scrollRight.setDisabledImage(arrowRightDisabledImage);
- scrollRight.setHotImage(arrowRightImage);
-}
-
-private Image drawArrowImage (Color foreground, Color background, boolean left) {
- // create image for left button
- int arrow[] = new int[6];
- if (left) {
- arrow[0] = 4; arrow[1] = 0;
- arrow[2] = 0; arrow[3] = 4;
- arrow[4] = 4; arrow[5] = 8;
- } else {
- arrow[0] = 0; arrow[1] = 0;
- arrow[2] = 4; arrow[3] = 4;
- arrow[4] = 0; arrow[5] = 8;
- }
-
- Image image = new Image(getDisplay(), 5, 9);
- GC gc = new GC(image);
- gc.setBackground(background);
- gc.fillRectangle(0, 0, 5, 9);
- gc.setBackground(foreground);
- gc.fillPolygon(arrow);
- gc.setBackground(background);
- gc.dispose();
+ scrollRight.setImage(arrowRightImage);
- return image;
+ int height = getTabHeight();
+ Point size = scrollBar.computeSize(SWT.DEFAULT, height);
+ scrollBar.setSize(size);
}
+
/**
* A mouse button was pressed down.
* If one of the tab scroll buttons was hit, scroll in the appropriate
@@ -1532,4 +1550,4 @@ public void setTabHeight(int height) {
fixedTabHeight = height + CTabItem.TOP_MARGIN + CTabItem.BOTTOM_MARGIN;
layoutItems();
}
-} \ No newline at end of file
+}
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
index 4c269a551e..1b72804de7 100755
--- 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
@@ -1,10 +1,10 @@
package org.eclipse.swt.custom;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class CTabFolderAdapter implements CTabFolderListener {
public void itemClosed(CTabFolderEvent event){};
-} \ No newline at end of file
+}
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
index 825d848700..c19ecfc43d 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.custom;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.events.TypedEvent;
@@ -15,4 +15,4 @@ public class CTabFolderEvent extends TypedEvent {
CTabFolderEvent(Widget w) {
super(w);
}
-} \ No newline at end of file
+}
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
index fd3938d351..c46e30c8d5 100755
--- 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
@@ -1,12 +1,12 @@
package org.eclipse.swt.custom;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import java.util.EventListener;
public interface CTabFolderListener {
public void itemClosed(CTabFolderEvent event);
-} \ No newline at end of file
+}
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
index fdcba65fc6..db93a6b6d1 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.custom;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.*;
@@ -39,19 +39,14 @@ public CTabItem (CTabFolder parent, int style) {
public CTabItem (CTabFolder parent, int style, int index) {
super (parent, checkStyle(style));
parent.createItem (this, index);
- addListener(SWT.Dispose, new Listener() {
- public void handleEvent(Event event) {
- onDispose();
- }
- });
}
private static int checkStyle(int style) {
return SWT.NONE;
}
-/**
- * Dispose the receiver.
- */
-private void onDispose() {
+
+public void dispose () {
+ if (isDisposed()) return;
+ super.dispose();
parent.destroyItem(this);
parent = null;
control = null;
@@ -403,4 +398,4 @@ private int textWidth(GC gc) {
}
return textWidth;
}
-} \ No newline at end of file
+}
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
index eb99ff6e53..0d6cd7af99 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.custom;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.*;
@@ -235,4 +235,4 @@ public void setEditor (Control editor) {
editor.setBounds (computeBounds ());
editor.setVisible (true);
}
-} \ No newline at end of file
+}
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
index 0469aa577c..51b9066831 100755
--- 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
@@ -1,10 +1,9 @@
package org.eclipse.swt.custom;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp 2000, 2001
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
-/* Imports */
import org.eclipse.swt.*;
import org.eclipse.swt.events.*;
import org.eclipse.swt.widgets.*;
@@ -82,8 +81,11 @@ int[][] addLineIndex(int start, int length, int[][] linesArray, int count) {
return newLines;
}
/**
- * Adds <code>TextChangedEvent</code> listener. A <code>TextChangedEvent</code> is sent
- * when changes to the textStore occur.
+ * 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
@@ -91,7 +93,7 @@ int[][] addLineIndex(int start, int length, int[][] linesArray, int count) {
* <li>ERROR_NULL_ARGUMENT when listener is null</li>
* </ul>
*/
-public void addTextChangedListener(TextChangedListener listener) {
+public void addTextChangeListener(TextChangeListener listener) {
if (listener == null) error(SWT.ERROR_NULL_ARGUMENT);
StyledTextListener typedListener = new StyledTextListener(listener);
textListeners.addElement(typedListener);
@@ -387,6 +389,31 @@ int lineCount(int startOffset, int length){
}
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
*/
@@ -649,7 +676,7 @@ public String getTextRange(int start, int length) {
return buf.toString();
}
/**
- * Removes the specified text changed listener.
+ * Removes the specified <code>TextChangeListener</code>.
* <p>
*
* @param listener the listener
@@ -657,7 +684,7 @@ public String getTextRange(int start, int length) {
* <li>ERROR_NULL_ARGUMENT when listener is null</li>
* </ul>
*/
-public void removeTextChangedListener(TextChangedListener listener){
+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);
@@ -672,11 +699,12 @@ public void removeTextChangedListener(TextChangedListener listener){
* for a length of <code>replaceLength</code>. Notifies the appropriate listeners.
* <p>
*
- * When sending the TextChangedEvent, <code>numNewLines</code> is the number of
- * inserted lines and <code>numReplacedLines</code> is the number of deleted lines based
- * on the change that occurs visually. For example:
+ * 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>(replacedText,newText) ==> (numReplacedLines,numNewLines)
+ * <li>(replaceText,newText) ==> (replaceLineCount,newLineCount)
* <li>("","\n") ==> (0,1)
* <li>("\n\n","a") ==> (2,0)
* </ul>
@@ -687,22 +715,25 @@ public void removeTextChangedListener(TextChangedListener listener){
* @param newText start offset of text to replace
*/
public void replaceTextRange(int start, int replaceLength, String newText){
+ // inform listeners
StyledTextEvent event = new StyledTextEvent(this);
- event.type = StyledText.TextReplaced;
+ event.type = StyledText.TextChanging;
event.start = start;
- event.replacedLineCount = lineCount(start, replaceLength);
- event.text = getTextRange(start, replaceLength);
+ 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.replacedLineCount + 1);
+ delete(start, replaceLength, event.replaceLineCount + 1);
// then insert the new text
insert(start, newText);
-
// inform listeners
- event.newLineCount = lineCount(start, newText.length());
- event.replacedCharCount = replaceLength;
- event.newCharCount = newText.length();
- sendTextEvent(event);
+ event = new StyledTextEvent(this);
+ event.type = StyledText.TextChanged;
+ sendTextEvent(event);
// printLines();
}
/**
@@ -793,5 +824,5 @@ void delete(int position, int length, int numLines) {
}
lineCount -= numOldLines;
gapLine = getLineAtPhysicalOffset(gapStart);
-}
-} \ No newline at end of file
+}
+}
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
index d6eaac6976..597459c314 100755
--- 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
@@ -1,10 +1,9 @@
package org.eclipse.swt.custom;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp 2000, 2001
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
-/* Imports */
import org.eclipse.swt.events.*;
import org.eclipse.swt.graphics.*;
import java.util.*;
@@ -227,7 +226,10 @@ StyleRange [] getStyleRanges() {
* @param event.background line background color (output)
*/
public void lineGetBackground(LineBackgroundEvent event) {
- event.lineBackground = lineBackgrounds[content.getLineAtOffset(event.lineOffset)];
+ int lineIndex = content.getLineAtOffset(event.lineOffset);
+ // 1GDX9PN
+ if (lineIndex > (lineBackgrounds.length - 1)) event.lineBackground = null;
+ else event.lineBackground = lineBackgrounds[lineIndex];
}
/**
* Handles the get line style information callback.
@@ -416,23 +418,24 @@ void setStyleRanges(StyleRange[] styles) {
styleExpandExp = 1;
}
/**
- * Updates the style ranges and line backgrounds to reflect a text change.
- * Called by StyledText when a TextChangedEvent is received.
+ * 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 textChanged(TextChangedEvent event) {
+public void textChanging(TextChangingEvent event) {
int startLine = content.getLineAtOffset(event.start);
int startLineOffset = content.getOffsetAtLine(startLine);
- textChanged(event.start, -event.replacedCharCount);
- textChanged(event.start, event.newCharCount);
+ textChanging(event.start, -event.replaceCharCount);
+ textChanging(event.start, event.newCharCount);
- if (event.newCharCount == content.getCharCount()) {
- // all text replaced, clear line backgrounds
- linesChanged(0, -lineCount);
- linesChanged(0, content.getLineCount());
+ 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;
}
@@ -440,18 +443,18 @@ public void textChanged(TextChangedEvent event) {
startLine = startLine + 1;
}
- linesChanged(startLine, -event.replacedLineCount);
- linesChanged(startLine, event.newLineCount);
+ linesChanging(startLine, -event.replaceLineCount);
+ linesChanging(startLine, event.newLineCount);
}
/*
- * Updates the line backgrounds to reflect a text change.
+ * Updates the line backgrounds to reflect a pending text change.
* <p>
*
- * @param start the starting line of the change that took place
+ * @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 linesChanged(int start, int delta) {
+void linesChanging(int start, int delta) {
if (delta == 0) return;
boolean inserting = delta > 0;
if (inserting) {
@@ -475,11 +478,12 @@ void linesChanged(int start, int delta) {
* Updates the style ranges to reflect a text change.
* <p>
*
- * @param start the starting offset of the change that took place
+ * @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 textChanged(int start, int delta) {
+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
@@ -596,4 +600,4 @@ StyleRange getStyleRangeAtOffset(int offset) {
newStyle.length = 1;
return newStyle;
}
-} \ No newline at end of file
+}
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
index 26fd9c9473..517471267d 100755
--- 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
@@ -1,10 +1,9 @@
package org.eclipse.swt.custom;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp 2000, 2001
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
-/* Imports */
import org.eclipse.swt.events.*;
/**
@@ -21,4 +20,4 @@ public ExtendedModifyEvent(StyledTextEvent e) {
length = e.end - e.start;
replacedText = e.text;
}
-} \ No newline at end of file
+}
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
index 5300f6da2d..59952fcdda 100755
--- 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
@@ -1,10 +1,9 @@
package org.eclipse.swt.custom;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp 2000, 2001
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
-/* Imports */
import java.util.EventListener;
public interface ExtendedModifyListener extends EventListener {
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
index fecd8742eb..711c84302d 100755
--- 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
@@ -1,10 +1,9 @@
package org.eclipse.swt.custom;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp 2000, 2001
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
-/* Imports */
import org.eclipse.swt.events.*;
import org.eclipse.swt.graphics.*;
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
index 7ea0deeb24..9607851c96 100755
--- 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
@@ -1,11 +1,10 @@
package org.eclipse.swt.custom;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp 2000, 2001
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
-/* Imports */
import java.util.*;
@@ -21,4 +20,4 @@ public interface LineBackgroundListener extends EventListener {
* @param event.lineBackground line background color (output)
*/
public void lineGetBackground(LineBackgroundEvent event);
-} \ No newline at end of file
+}
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
index 0bac2326a3..86a7e0c7a6 100755
--- 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
@@ -1,10 +1,9 @@
package org.eclipse.swt.custom;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp 2000, 2001
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
-/* Imports */
import org.eclipse.swt.events.*;
import org.eclipse.swt.graphics.*;
@@ -22,4 +21,4 @@ public LineStyleEvent(StyledTextEvent e) {
lineText = e.text;
styles = e.styles;
}
-} \ No newline at end of file
+}
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
index 6ece0586e5..23fc3b518e 100755
--- 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
@@ -1,10 +1,9 @@
package org.eclipse.swt.custom;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp 2000, 2001
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
-/* Imports */
import java.util.*;
public interface LineStyleListener extends EventListener {
@@ -18,4 +17,4 @@ public interface LineStyleListener extends EventListener {
* @param event.styles array of StyleRanges, need to be in order (output)
*/
public void lineGetStyle(LineStyleEvent event);
-} \ No newline at end of file
+}
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
index f03c817c1c..5f650a3396 100755
--- 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
@@ -1,9 +1,8 @@
package org.eclipse.swt.custom;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.*;
import org.eclipse.swt.events.*;
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
index 533f6f2e82..5be042724e 100755
--- 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
@@ -1,10 +1,9 @@
package org.eclipse.swt.custom;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp 2000, 2001
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
-/* Imports */
import org.eclipse.swt.*;
/**
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
index 27bc05ae52..86abf0b90b 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.custom;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.*;
@@ -316,8 +316,21 @@ public void setOrientation(int orientation) {
}
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) {
- // SashForm does not use Layout
}
/**
* Specify the control that should take up the entire client area of the SashForm.
@@ -381,4 +394,4 @@ public void setWeights(int[] weights) {
layout();
}
-} \ No newline at end of file
+}
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
index cd9ac851a2..fced63b944 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.custom;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.*;
@@ -199,4 +199,4 @@ private void vScroll() {
int vSelection = vBar.getSelection ();
content.setLocation (location.x, -vSelection);
}
-} \ No newline at end of file
+}
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
index a193ad5a24..02fab5cb46 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.custom;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.*;
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
index 12623a5b22..10ca96699c 100755
--- 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
@@ -1,10 +1,9 @@
package org.eclipse.swt.custom;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp 2000, 2001
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
-/* Imports */
import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
@@ -144,4 +143,4 @@ public String toString() {
}
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/StyledText.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledText.java
index b6f2c2ecda..c65cfd471a 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledText.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledText.java
@@ -1,10 +1,9 @@
package org.eclipse.swt.custom;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp 2000, 2001
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
-/* Imports */
import org.eclipse.swt.*;
import org.eclipse.swt.dnd.*;
import org.eclipse.swt.events.*;
@@ -72,7 +71,7 @@ public class StyledText extends Canvas {
private final static String PlatformLineDelimiter = System.getProperty("line.separator");
StyledTextContent content;
- TextChangedListener textChangedListener; // listener for TextReplaced and TextSet events from StyledTextContent
+ TextChangeListener textChangeListener; // listener for TextChanging, TextChanged and TextSet events from StyledTextContent
DefaultLineStyler defaultLineStyler;// used for setStyles API when no LineStyleListener is registered
boolean userLineStyle = false; // true=widget is using a user defined line style listener for line styles. false=widget is using the default line styler to store line styles
boolean userLineBackground = false;// true=widget is using a user defined line background listener for line backgrounds. false=widget is using the default line styler to store line backgrounds
@@ -100,17 +99,21 @@ public class StyledText extends Canvas {
Font boldFont;
Font regularFont;
Clipboard clipboard;
-
boolean mouseDoubleClick = false; // true=a double click ocurred. Don't do mouse swipe selection.
int autoScrollDirection = SWT.NULL; // the direction of autoscrolling (up, down, right, left)
+ int lastTextChangeStart; // cache data of the
+ int lastTextChangeNewLineCount; // last text changing
+ int lastTextChangeNewCharCount; // event for use in the
+ int lastTextChangeReplaceCharCount; // text changed handler
static final int DEFAULT_WIDTH = 64;
static final int DEFAULT_HEIGHT = 64;
static final int ExtendedModify = 3000;
- static final int LineGetStyle = 3002;
static final int LineGetBackground = 3001;
- static final int TextReplaced = 3003;
+ static final int LineGetStyle = 3002;
+ static final int TextChanging = 3003;
+ static final int TextChanged = 3006;
static final int TextSet = 3004;
static final int VerifyKey = 3005;
/**
@@ -225,7 +228,7 @@ public class StyledText extends Canvas {
* widget document. Any text occurring before the start offset or after the
* end offset specified during object creation is ignored.
* @exception SWTException <ul>
- * <li>ERROR_IO when the writer is closed. @see close()</li>
+ * <li>ERROR_IO when the writer is closed.</li>
* </ul>
*/
public void writeLine(String line, int lineOffset) {
@@ -255,7 +258,7 @@ public class StyledText extends Canvas {
*
* @param lineDelimiter line delimiter to write as RTF.
* @exception SWTException <ul>
- * <li>ERROR_IO when the writer is closed. @see close()</li>
+ * <li>ERROR_IO when the writer is closed.</li>
* </ul>
*/
public void writeLineDelimiter(String lineDelimiter) {
@@ -513,7 +516,7 @@ public class StyledText extends Canvas {
* widget document. Any text occurring before the start offset or after the
* end offset specified during object creation is ignored.
* @exception SWTException <ul>
- * <li>ERROR_IO when the writer is closed. @see close()</li>
+ * <li>ERROR_IO when the writer is closed.</li>
* </ul>
*/
public void writeLine(String line, int lineOffset) {
@@ -546,7 +549,7 @@ public class StyledText extends Canvas {
*
* @param lineDelimiter line delimiter to write
* @exception SWTException <ul>
- * <li>ERROR_IO when the writer is closed. @see close()</li>
+ * <li>ERROR_IO when the writer is closed.</li>
* </ul>
*/
public void writeLineDelimiter(String lineDelimiter) {
@@ -619,8 +622,6 @@ public void addExtendedModifyListener(ExtendedModifyListener extendedModifyListe
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
- * @see org.eclipse.swt.SWT
- * @see org.eclipse.swt.ST
*/
public void setKeyBinding(int key, int action) {
checkWidget();
@@ -1052,13 +1053,19 @@ public void copy(){
TextTransfer plainTextTransfer = TextTransfer.getInstance();
RTFWriter rtfWriter = new RTFWriter(selection.x, length);
TextWriter plainTextWriter = new TextWriter(selection.x, length);
- String rtfText;
- String plainText;
- rtfText = getPlatformDelimitedText(rtfWriter);
- plainText = getPlatformDelimitedText(plainTextWriter);
- clipboard.setContents(
- new String[]{rtfText, plainText},
- new Transfer[]{rtfTransfer, plainTextTransfer});
+ String rtfText = getPlatformDelimitedText(rtfWriter);
+ String plainText = getPlatformDelimitedText(plainTextWriter);
+
+ try {
+ clipboard.setContents(
+ new String[]{rtfText, plainText},
+ new Transfer[]{rtfTransfer, plainTextTransfer});
+ }
+ catch (SWTError error) {
+ // Copy to clipboard failed. This happens when another application
+ // is accessing the clipboard while we copy. Ignore the error.
+ // Fixes 1GDQAVN
+ }
}
}
@@ -1557,7 +1564,7 @@ void doMouseLocationChange(int x, int y, boolean select) {
int newCaretOffset;
int lineOffset = content.getOffsetAtLine(line);
- if (select && selection.x == lineOffset && line < lineCount - 1) {
+ if (select && selectionAnchor == lineOffset && line < lineCount - 1) {
GC gc = new GC(this);
int lineLength = lineText.length();
// represent the line break as one additional white space
@@ -2097,7 +2104,9 @@ void drawStyledLine(String line, int lineOffset, int renderOffset, StyleRange[]
for (int i = 0; i < styles.length && paintX < renderStopX; i++) {
int styleLineLength;
int styleLineStart;
+ int styleLineEnd;
style = styles[i];
+ styleLineEnd = style.start + style.length - lineOffset;
styleLineStart = Math.max(style.start - lineOffset, 0);
// render unstyled text between the start of the current
// style range and the end of the previously rendered
@@ -2110,17 +2119,18 @@ void drawStyledLine(String line, int lineOffset, int renderOffset, StyleRange[]
paintX = drawText(line, lineOffset, renderOffset, styleLineStart - renderOffset, filteredStyles, paintX, paintY, gc);
renderOffset = styleLineStart;
}
- styleLineLength = Math.min(style.start - lineOffset + style.length, lineLength) - renderOffset;
- if (styleLineLength == 0) {
- // there are line styles but no text for those styles
- // possible when called with partial line text
- break;
- }
- else
- if (styleLineLength < 0) {
+ else
+ if (styleLineEnd <= renderOffset) {
// style ends before render start offset
+ // skip to the next style
continue;
}
+ if (styleLineStart >= lineLength) {
+ // there are line styles but no text for those styles
+ // possible when called with partial line text
+ break;
+ }
+ styleLineLength = Math.min(styleLineEnd, lineLength) - renderOffset;
// set style background color if specified
if (style.background != null) {
background = setLineBackground(gc, background, style.background);
@@ -2367,8 +2377,6 @@ public int getHorizontalPixel() {
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
- * @see org.eclipse.swt.SWT
- * @see org.eclipse.swt.ST
*/
public int getKeyBinding(int key) {
checkWidget();
@@ -2690,7 +2698,7 @@ String getPlatformDelimitedText(TextWriter writer) {
*
* @return start and end of the selection, x is the offset of the first selected
* character, y is the offset after the last selected character
- * @see getSelectionRange()
+ * @see #getSelectionRange
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
@@ -3164,8 +3172,11 @@ public void insert(String string) {
* Creates content change listeners and set the default content model.
*/
void installDefaultContent() {
- textChangedListener = new TextChangedListener() {
- public void textReplaced(TextChangedEvent event) {
+ textChangeListener = new TextChangeListener() {
+ public void textChanging(TextChangingEvent event) {
+ handleTextChanging(event);
+ }
+ public void textChanged(TextChangedEvent event) {
handleTextChanged(event);
}
public void textSet(TextChangedEvent event) {
@@ -3173,7 +3184,7 @@ void installDefaultContent() {
}
};
content = new DefaultContent();
- content.addTextChangedListener(textChangedListener);
+ content.addTextChangeListener(textChangeListener);
}
/**
* Creates a default line style listener.
@@ -3181,7 +3192,7 @@ void installDefaultContent() {
* Removed when the user sets a LineStyleListener.
* <p>
*
- * @see addLineStyleListener
+ * @see #addLineStyleListener
*/
void installDefaultLineStyler() {
defaultLineStyler = new DefaultLineStyler(content);
@@ -3293,7 +3304,7 @@ void handleDispose() {
boldFont.dispose();
}
if (content != null) {
- content.removeTextChangedListener(textChangedListener);
+ content.removeTextChangeListener(textChangeListener);
}
}
@@ -3475,93 +3486,151 @@ void handleResize(Event event) {
}
/**
- * Updates the caret position and selection to reflect the content change.
- * Redraws the changed area.
+ * Updates the caret position and selection and the scroll bars to reflect
+ * the content change.
* <p>
- *
- * @param event.start the start offset of the change
- * @param event.replacedCharCount the length of the replaced text
- * @param event.newCharCount the length of the new text
- * @param event.replacedLineCount number of replaced lines.
- * @param event.newLineCount number of new lines.
*/
void handleTextChanged(TextChangedEvent event) {
+ int visibleItemCount = (int) Math.ceil((float) getClientArea().height / lineHeight);
+ int firstLine = content.getLineAtOffset(lastTextChangeStart);
+ int stopLine;
+
+ // calculate width of visible changed lines
+ stopLine = firstLine + lastTextChangeNewLineCount + 1;
+ if (stopLine > topIndex && firstLine < topIndex + visibleItemCount) {
+ int startLine = Math.max(firstLine, topIndex);
+ calculateContentWidth(
+ startLine,
+ Math.min(stopLine, topIndex + visibleItemCount) - startLine);
+ }
+ setScrollBars();
+ // update selection/caret location after styles have been changed.
+ // otherwise any text measuring could be incorrect
+ //
+ // also, this needs to be done after all scrolling. Otherwise,
+ // selection redraw would be flushed during scroll which is wrong.
+ // in some cases new text would be drawn in scroll source area even
+ // though the intent is to scroll it.
+ // fixes 1GB93QT
+ updateSelection(
+ lastTextChangeStart,
+ lastTextChangeReplaceCharCount,
+ lastTextChangeNewCharCount);
+
+ int newVerticalOffset = getLineCount() * getLineHeight() - getClientArea().height;
+ if (newVerticalOffset < verticalScrollOffset) {
+ // Scroll up so that empty lines below last text line are used.
+ // Fixes 1GEYJM0
+ setVerticalScrollOffset(Math.max(0, newVerticalOffset), true);
+ }
+}
+/**
+ * Updates the screen to reflect a pending content change.
+ * <p>
+ *
+ * @param event.start the start offset of the change
+ * @param event.newText text that is going to be inserted or empty String
+ * if no text will be inserted
+ * @param event.replaceCharCount length of text that is going to be replaced
+ * @param event.newCharCount length of text that is going to be inserted
+ * @param event.replaceLineCount number of lines that are going to be replaced
+ * @param event.newLineCount number of new lines that are going to be inserted
+ */
+void handleTextChanging(TextChangingEvent event) {
int firstLine;
int firstLineOffset;
int offsetInLine;
String firstLineText;
int stopLine;
- boolean isMultiLineChange = event.replacedLineCount > 0 || event.newLineCount > 0;
+ boolean isMultiLineChange = event.replaceLineCount > 0 || event.newLineCount > 0;
int textChangeX = -1;
int textChangeY;
int oldTabX = 0;
int textChangeStopX = -1;
int visibleItemCount = (int) Math.ceil((float) getClientArea().height / lineHeight);
- if (event.replacedCharCount < 0) {
- event.start += event.replacedCharCount;
- event.replacedCharCount *= -1;
- }
+ if (event.replaceCharCount < 0) {
+ event.start += event.replaceCharCount;
+ event.replaceCharCount *= -1;
+ }
+ lastTextChangeStart = event.start;
+ lastTextChangeNewLineCount = event.newLineCount;
+ lastTextChangeNewCharCount = event.newCharCount;
+ lastTextChangeReplaceCharCount = event.replaceCharCount;
firstLine = content.getLineAtOffset(event.start);
firstLineText = content.getLine(firstLine);
firstLineOffset = content.getOffsetAtLine(firstLine);
offsetInLine = event.start - firstLineOffset;
if (isMultiLineChange == false) {
// get location of nearest tab and replace stop offset in old text
- int oldTabIndex;
- String oldLine;
- StringBuffer oldLineText = new StringBuffer(firstLineText);
- oldLineText.delete(offsetInLine, offsetInLine + event.newCharCount);
- if (event.replacedText != null && event.replacedText.length() > 0) {
- oldLineText.insert(offsetInLine, event.replacedText);
- }
- oldLine = oldLineText.toString();
- oldTabIndex = oldLine.indexOf(TAB, offsetInLine + event.replacedCharCount);
- oldTabX = getXAtOffset(oldLine, firstLine, oldTabIndex + 1);
+ int oldTabIndex = firstLineText.indexOf(TAB, offsetInLine + event.replaceCharCount);
+ oldTabX = getXAtOffset(firstLineText, firstLine, oldTabIndex + 1);
if (event.newCharCount == 0) {
- // characters were deleted. find out where the last deleted
- // character stopped drawing
+ // characters are going to be deleted. find out where the last deleted
+ // character stops drawing.
+ // This will be used in redrawSingleLineChange as the bit blit source
+ // x position. It has to be calculated before the styles are updated
+ // because the deleted text may be bold. If the styles are deleted
+ // before the calculation, the resulting x position would not reflect
+ // the bold style thus causing incorrect blitting to occur.
textChangeStopX = getXAtOffset(
- oldLine,
+ firstLineText,
firstLine,
- offsetInLine + event.replacedCharCount);
- }
- else
- if (event.replacedCharCount == 0) {
- // characters were added. find out where before the styles are
- // updated to reflect the text change
- textChangeX = getXAtOffset(oldLine, firstLine, offsetInLine);
+ offsetInLine + event.replaceCharCount);
}
}
- // notify default line styler about text change
- if (defaultLineStyler != null) {
- defaultLineStyler.textChanged(event);
- }
- // calculate width of visible changed lines
- stopLine = firstLine + event.newLineCount + 1;
- if (stopLine > topIndex && firstLine < topIndex + visibleItemCount) {
- int startLine = Math.max(firstLine, topIndex);
- calculateContentWidth(startLine, Math.min(stopLine, topIndex + visibleItemCount) - startLine);
- }
- setScrollBars();
textChangeY = firstLine * lineHeight - verticalScrollOffset;
- if (textChangeX == -1) {
- textChangeX = getXAtOffset(firstLineText, firstLine, offsetInLine);
- }
if (isMultiLineChange) {
- redrawMultiLineChange(textChangeX, textChangeY, event.newLineCount, event.replacedLineCount);
+ textChangeX = getXAtOffset(firstLineText, firstLine, offsetInLine);
+ redrawMultiLineChange(
+ textChangeX,
+ textChangeY,
+ event.newLineCount,
+ event.replaceLineCount);
+ // notify default line styler about text change
+ if (defaultLineStyler != null) {
+ defaultLineStyler.textChanging(event);
+ }
}
else {
- int newTabIndex = firstLineText.indexOf(TAB, offsetInLine + event.newCharCount);
+ // get location of nearest tab and replace stop offset in new text
+ int newTabIndex;
+ String newLine;
+ StringBuffer newLineText = new StringBuffer(firstLineText);
+ newLineText.delete(offsetInLine, offsetInLine + event.replaceCharCount);
+ if (event.newText != null && event.newText.length() > 0) {
+ newLineText.insert(offsetInLine, event.newText);
+ }
+ newLine = newLineText.toString();
+ newTabIndex = newLine.indexOf(TAB, offsetInLine + event.newCharCount);
+
+ // flush pending redraws before changing the line styles to reflect
+ // the pending text change
+ update();
+ // notify default line styler about text change
+ if (defaultLineStyler != null) {
+ defaultLineStyler.textChanging(event);
+ }
+ // it is safe to calculate the change start x position after the
+ // styles have been updated since the styles only change behind the
+ // change start offset, not before.
+ textChangeX = getXAtOffset(firstLineText, firstLine, offsetInLine);
if (newTabIndex != -1) {
- // there is at least one tab after the text change
- int newTabX = getXAtOffset(firstLineText, firstLine, newTabIndex + 1);
- redrawSingleLineTabChange(textChangeX, textChangeY, newTabX, oldTabX);
+ // there is at least one tab character after the text change
+ int newTabX = getXAtOffset(newLine, firstLine, newTabIndex + 1);
+ redrawSingleLineTabChange(textChangeX, textChangeY, newTabX, oldTabX);
}
else {
if (textChangeStopX == -1) {
+ // text change stop x position has not been calculated yet.
+ // This means that text is going to be inserted. Calculate
+ // the x position behind the inserted text. It will be used
+ // in redrawSingleLineChange as the bit blit destination x
+ // position. The x position has to be calculated after the
+ // styles have been updated because the calculation uses the
+ // styles of the new text which otherwise may not exist yet.
textChangeStopX = getXAtOffset(
- firstLineText,
+ newLine,
firstLine,
offsetInLine + event.newCharCount);
}
@@ -3569,19 +3638,10 @@ void handleTextChanged(TextChangedEvent event) {
textChangeX,
textChangeY,
event.newCharCount,
- event.replacedCharCount,
+ event.replaceCharCount,
textChangeStopX);
}
}
- // update selection/caret location after styles have been changed.
- // otherwise any text measuring could be incorrect
- //
- // also, this needs to be done after all scrolling. Otherwise,
- // selection redraw would be flushed during scroll which is wrong.
- // in some cases new text would be drawn in scroll source area even
- // though the intent is to scroll it.
- // fixes 1GB93QT
- updateSelection(event.start, event.replacedCharCount, event.newCharCount);
}
/**
* Called when the widget content is set programatically, overwriting
@@ -3617,7 +3677,6 @@ void initializeFonts() {
* <p>
*
* @param action one of the actions defined in ST.java
- * @see ST.java
*/
public void invokeAction(int action) {
switch (action) {
@@ -3934,17 +3993,17 @@ void redrawMultiLineChange(int x, int y, int newLineCount, int replacedLineCount
int destinationY;
if (lineCount > 0) {
- sourceY = y + lineHeight;
- destinationY = y + lineCount * lineHeight + lineHeight;
- }
+ sourceY = Math.max(0, y + lineHeight);
+ destinationY = sourceY + lineCount * lineHeight;
+ }
else {
- sourceY = y - lineCount * lineHeight + lineHeight;
- destinationY = y + lineHeight;
- }
+ destinationY = Math.max(0, y + lineHeight);
+ sourceY = destinationY - lineCount * lineHeight;
+ }
scroll(
0, destinationY, // destination x, y
0, sourceY, // source x, y
- clientArea.width, clientArea.height, true);
+ clientArea.width, clientArea.height, true);
// Always redrawing causes the bottom line to flash when a line is
// deleted. This is because SWT merges the paint area of the scroll
// with the paint area of the redraw call below.
@@ -3957,9 +4016,18 @@ void redrawMultiLineChange(int x, int y, int newLineCount, int replacedLineCount
// (the flash is only on the bottom line and minor).
// Specifying the NO_MERGE_PAINTS style bit prevents the merged
// redraw but could cause flash/slowness elsewhere.
- redraw(x, y, clientArea.width, lineHeight, true);
+ if (y + lineHeight > 0 && y <= clientArea.height) {
+ // redraw first changed line in case a line was split/joined
+ redraw(x, y, clientArea.width, lineHeight, true);
+ }
if (newLineCount > 0) {
- redraw(0, y + lineHeight, clientArea.width, newLineCount * lineHeight, true);
+ int redrawStartY = y + lineHeight;
+ int redrawHeight = newLineCount * lineHeight;
+
+ if (redrawStartY + redrawHeight > 0 && redrawStartY <= clientArea.height) {
+ // display new text
+ redraw(0, redrawStartY, clientArea.width, redrawHeight, true);
+ }
}
}
/**
@@ -4362,11 +4430,6 @@ void setCaretLocation() {
int lineX = getXAtOffset(content.getLine(line), line, caretOffset - lineStartOffset);
int lineHeight = getLineHeight();
- // workaround for 1G3AKJO exposed by Leapfrog
- // causes flashing but works
- if (caret.isVisible() == false) {
- setRedraw(true);
- }
caret.setLocation(lineX, line * lineHeight - verticalScrollOffset);
}
/**
@@ -4424,10 +4487,10 @@ public void setContent(StyledTextContent content) {
SWT.error(SWT.ERROR_NULL_ARGUMENT);
}
if (this.content != null) {
- this.content.removeTextChangedListener(textChangedListener);
+ this.content.removeTextChangeListener(textChangeListener);
}
this.content = content;
- content.addTextChangedListener(textChangedListener);
+ content.addTextChangeListener(textChangeListener);
reset();
}
@@ -4725,7 +4788,7 @@ void setScrollBars() {
* <li>ERROR_INVALID_RANGE when start is outside the widget content
* </ul>
*/
-public void setSelection (int start) {
+public void setSelection(int start) {
setSelection(start, start);
}
/**
@@ -4956,7 +5019,7 @@ public void setStyleRanges(StyleRange[] ranges) {
}
}
defaultLineStyler.setStyleRanges(ranges);
- redraw(); // bogus! only redraw affected area to avoid flashing
+ redraw(); // should only redraw affected area to avoid flashing
// make sure that the caret is positioned correctly.
// caret location may change if font style changes.
// fixes 1G8FODP
@@ -5394,15 +5457,17 @@ void updateSelection(int startOffset, int replacedLength, int newLength) {
// clear selection fragment before text change
redrawRange(selection.x, startOffset - selection.x, true);
}
- if (selection.y > startOffset + replacedLength) {
- // clear selection fragment after text change
+ if (selection.y > startOffset + replacedLength && selection.x < startOffset + replacedLength) {
+ // clear selection fragment after text change.
+ // do this only when the selection is actually affected by the
+ // change. Selection is only affected if it intersects the change (1GDY217).
int netNewLength = newLength - replacedLength;
int redrawStart = startOffset + newLength;
redrawRange(redrawStart, selection.y + netNewLength - redrawStart, true);
}
if (selection.y > startOffset && selection.x < startOffset + replacedLength) {
// selection intersects replaced text. set caret behind text change
- caretOffset = selection.x = selection.y = startOffset + newLength;
+ internalSetSelection(startOffset + newLength, 0);
// always update the caret location. fixes 1G8FODP
setCaretLocation();
}
@@ -5423,4 +5488,4 @@ void updateSelection(int startOffset, int replacedLength, int newLength) {
boolean isSingleLine() {
return (getStyle() & SWT.SINGLE) != 0;
}
-} \ 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
index 839366cbf2..cd4995f94d 100755
--- 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
@@ -1,18 +1,18 @@
package org.eclipse.swt.custom;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp 2000, 2001
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
-/* Imports */
import org.eclipse.swt.events.*;
public interface StyledTextContent {
/**
* Called by StyledText to add itself as an Observer to content changes.
- * Implementors should send a TextChangedEvent when changes to the content
- * occur. The widget only updates the screen when it receives a TextChangedEvent.
+ * 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
@@ -20,7 +20,7 @@ public interface StyledTextContent {
* <li>ERROR_NULL_ARGUMENT when listener is null</li>
* </ul>
*/
-public void addTextChangedListener(TextChangedListener listener);
+public void addTextChangeListener(TextChangeListener listener);
/**
* Return the number of characters in the content.
@@ -129,27 +129,38 @@ public String getTextRange(int start, int length);
* <li>ERROR_NULL_ARGUMENT when listener is null</li>
* </ul>
*/
-public void removeTextChangedListener(TextChangedListener listener);
+public void removeTextChangeListener(TextChangeListener listener);
/**
* Replace the text with "newText" starting at position "start"
* for a length of "replaceLength".
* <p>
- * Implementors have to notify TextChanged listeners after the content has
- * been updated. The TextChangedEvent should be set as follows:
+ * 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.type = SWT.TextReplaced
* <li>event.start = start of the replaced text
- * <li>event.numReplacedLines = number of replaced lines
- * <li>event.numNewLines = number of new lines
- * <li>event.replacedLength = length of the replaced text
- * <li>event.newLength = length of the new 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> numNewLines is the number of inserted lines and numReplacedLines is
+ * <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>(replacedText, newText) ==> (numReplacedLines, numNewLines)
+ * <li>(replaceText, newText) ==> (replaceLineCount, newLineCount)
* <li>("", "\n") ==> (0, 1)
* <li>("\n\n", "a") ==> (2, 0)
* <li>("a", "\n\n") ==> (0, 2)
@@ -166,12 +177,11 @@ public void replaceTextRange(int start, int replaceLength, String text);
/**
* Set text to "text".
- * Implementors have to notify TextChanged listeners after the content has
- * been updated. The TextChangedEvent being sent must have the event type
- * set to SWT.TextSet.
+ * 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);
-} \ No newline at end of file
+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
index 52c6ca7c8d..f67b669139 100755
--- 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
@@ -1,10 +1,9 @@
package org.eclipse.swt.custom;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp 2000, 2001
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
-/* Imports */
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.widgets.*;
@@ -17,9 +16,9 @@ class StyledTextEvent extends Event {
// used by LineBackgroundEvent
Color lineBackground;
// used by TextChangedEvent
- int replacedCharCount;
+ int replaceCharCount;
int newCharCount;
- int replacedLineCount;
+ int replaceLineCount;
int newLineCount;
StyledTextEvent (StyledTextContent 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
index 7514f0bb44..2808634a45 100755
--- 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
@@ -1,10 +1,9 @@
package org.eclipse.swt.custom;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp 2000, 2001
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
-/* Imports */
import org.eclipse.swt.events.*;
import org.eclipse.swt.widgets.*;
import java.util.*;
@@ -45,15 +44,19 @@ public void handleEvent(Event e) {
e.doit = verifyEvent.doit;
break;
+ case StyledText.TextChanging:
+ TextChangingEvent textChangingEvent = new TextChangingEvent((StyledTextContent) e.data, (StyledTextEvent) e);
+ ((TextChangeListener) eventListener).textChanging(textChangingEvent);
+ break;
- case StyledText.TextReplaced:
- textChangedEvent = new TextChangedEvent((StyledTextContent)e.data, (StyledTextEvent) e);
- ((TextChangedListener) eventListener).textReplaced(textChangedEvent);
+ case StyledText.TextChanged:
+ textChangedEvent = new TextChangedEvent((StyledTextContent) e.data);
+ ((TextChangeListener) eventListener).textChanged(textChangedEvent);
break;
case StyledText.TextSet:
- textChangedEvent = new TextChangedEvent((StyledTextContent)e.data, (StyledTextEvent) e);
- ((TextChangedListener) eventListener).textSet(textChangedEvent);
+ 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
index f9e18e66ef..27e67857e7 100755
--- 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
@@ -1,5 +1,10 @@
package org.eclipse.swt.custom;
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
import java.io.*;
import java.util.*;
import org.eclipse.swt.*;
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
index a17caf48d7..1fdca24770 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.custom;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.*;
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
index 8ab256b7e1..ae8005ab4c 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.custom;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import java.util.Enumeration;
@@ -17,7 +17,14 @@ import org.eclipse.swt.widgets.*;
* 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
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
index 75a0814d5f..2ac7bba01e 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.custom;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.*;
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
index a73f8f6433..31bf476b07 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.custom;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.*;
@@ -101,11 +101,6 @@ TableTreeItem(TableTree parent, TableTreeItem parentItem, int style, int index)
} else {
parentItem.addItem(this, index);
}
- addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- TableTreeItem.this.widgetDisposed(e);
- }
- });
}
void addCheck() {
Table table = parent.getTable();
@@ -351,10 +346,12 @@ int visibleChildrenCount () {
return count;
}
-void widgetDisposed(DisposeEvent e) {
+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);
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
new file mode 100755
index 0000000000..0ec851abe5
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/TextChangeListener.java
@@ -0,0 +1,43 @@
+package org.eclipse.swt.custom;
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import java.util.*;
+
+/**
+ * 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 EventListener {
+
+/**
+ * @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
index 0aea1259ec..5a7648cd8b 100755
--- 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
@@ -1,10 +1,9 @@
package org.eclipse.swt.custom;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp 2000, 2001
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
-/* Imports */
import org.eclipse.swt.events.*;
/**
@@ -12,13 +11,6 @@ import org.eclipse.swt.events.*;
* the text occurs.
*/
public class TextChangedEvent extends TypedEvent {
- public int start; // replace start offset
- public String replacedText; // the replaced text or empty String of no text was replaced
- public int replacedCharCount; // length of text being replaced
- public int newCharCount; // length of new text
- public int replacedLineCount; // number of lines replaced
- public int newLineCount; // number of new lines
-
/**
* Create the TextChangedEvent to be used by the StyledTextContent implementor.
* <p>
@@ -28,14 +20,4 @@ public class TextChangedEvent extends TypedEvent {
public TextChangedEvent(StyledTextContent source) {
super(source);
}
-TextChangedEvent(StyledTextContent source, StyledTextEvent e) {
- super(source);
- start = e.start;
- replacedCharCount = e.replacedCharCount;
- newCharCount = e.newCharCount;
- replacedLineCount = e.replacedLineCount;
- newLineCount = e.newLineCount;
- replacedText = e.text;
-}
-
-} \ No newline at end of file
+}
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
new file mode 100755
index 0000000000..b334ead550
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/TextChangingEvent.java
@@ -0,0 +1,41 @@
+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
index b00e3d77ff..9200f0e789 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.custom;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.*;
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
index a5766fc2d8..930531a984 100755
--- 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
@@ -1,10 +1,9 @@
package org.eclipse.swt.custom;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp 2000, 2001
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
-/* Imports */
import org.eclipse.swt.events.*;
import java.util.*;
@@ -16,4 +15,4 @@ public interface VerifyKeyListener extends EventListener {
* @param event.doit processed or not (output)
*/
public void verifyKey (VerifyEvent event);
-} \ No newline at end of file
+}
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
index aafe3891fa..6529b0109d 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.custom;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.graphics.*;
@@ -63,6 +63,7 @@ public class ViewForm extends Composite {
private Color borderColor3;
private Rectangle oldArea;
+ private static final int OFFSCREEN = -200;
/**
* Creates a ViewForm.
* <p>
@@ -376,7 +377,7 @@ public void setContent(Control content) {
SWT.error(SWT.ERROR_INVALID_ARGUMENT);
}
if (this.content != null && !this.content.isDisposed()) {
- this.content.setVisible(false);
+ this.content.setBounds(OFFSCREEN, OFFSCREEN, 0, 0);
}
this.content = content;
layout();
@@ -394,8 +395,21 @@ public void setFont(Font 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) {
- // no layout may be set on the ViewForm
return;
}
/**
@@ -409,7 +423,7 @@ public void setTopCenter(Control topCenter) {
SWT.error(SWT.ERROR_INVALID_ARGUMENT);
}
if (this.topCenter != null && !this.topCenter.isDisposed()) {
- this.topCenter.setVisible(false);
+ this.topCenter.setBounds(OFFSCREEN, OFFSCREEN, 0, 0);
}
this.topCenter = topCenter;
layout();
@@ -425,7 +439,7 @@ public void setTopLeft(Control c) {
SWT.error(SWT.ERROR_INVALID_ARGUMENT);
}
if (this.topLeft != null && !this.topLeft.isDisposed()) {
- this.topLeft.setVisible(false);
+ this.topLeft.setBounds(OFFSCREEN, OFFSCREEN, 0, 0);
}
this.topLeft = c;
layout();
@@ -441,7 +455,7 @@ public void setTopRight(Control c) {
SWT.error(SWT.ERROR_INVALID_ARGUMENT);
}
if (this.topRight != null && !this.topRight.isDisposed()) {
- this.topRight.setVisible(false);
+ this.topRight.setBounds(OFFSCREEN, OFFSCREEN, 0, 0);
}
this.topRight = c;
layout();
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/close.gif b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/close.gif
new file mode 100755
index 0000000000..5d99e83d59
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/close.gif
Binary files differ
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/left.gif b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/left.gif
new file mode 100755
index 0000000000..d805f3aadf
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/left.gif
Binary files differ
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/leftDisabled.gif b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/leftDisabled.gif
new file mode 100755
index 0000000000..6317a41635
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/leftDisabled.gif
Binary files differ
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
index 2f36647b51..cb946ce558 100755
--- 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
@@ -5,9 +5,10 @@
<title>Package-level Javadoc</title>
</head>
<body>
-Brief overview will be provided here.
+SWT Custom widgets.
<h2>
Package Specification</h2>
-Detailed overview will be provided here.
+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 Custom Widgets/common/org/eclipse/swt/custom/right.gif b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/right.gif
new file mode 100755
index 0000000000..8333e9a940
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/right.gif
Binary files differ
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/rightDisabled.gif b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/rightDisabled.gif
new file mode 100755
index 0000000000..231e6c81ff
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/rightDisabled.gif
Binary files differ
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
index bfe342091a..a7d783eb0b 100755
--- 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
@@ -1,9 +1,8 @@
package org.eclipse.swt.dnd;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.*;
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
index d7c41f301c..e0dfd61d96 100755
--- 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
@@ -1,5 +1,10 @@
package org.eclipse.swt.dnd;
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
import org.eclipse.swt.widgets.*;
class DNDEvent extends Event {
@@ -9,4 +14,4 @@ class DNDEvent extends Event {
public int operations;
public int feedback;
-} \ No newline at end of file
+}
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
index 5f2c2e7c1a..b3d529c478 100755
--- 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
@@ -1,9 +1,8 @@
package org.eclipse.swt.dnd;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.widgets.Event;
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
index ab728a91ea..30a349cafd 100755
--- 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
@@ -1,12 +1,12 @@
package org.eclipse.swt.dnd;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (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){};
-} \ No newline at end of file
+}
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
index 655c2df91d..f47370a7c6 100755
--- 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
@@ -1,9 +1,8 @@
package org.eclipse.swt.dnd;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.events.TypedEvent;
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
index 3024d06d5f..ea57526fde 100755
--- 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
@@ -1,9 +1,8 @@
package org.eclipse.swt.dnd;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import java.util.EventListener;
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
index 7c2c886e28..fc55ade742 100755
--- 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
@@ -1,14 +1,14 @@
package org.eclipse.swt.dnd;
-import org.eclipse.swt.widgets.*;
-
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (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);
-} \ No newline at end of file
+}
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
index eaac3c6678..2b551b138c 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.dnd;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class DropTargetAdapter implements DropTargetListener {
@@ -15,4 +15,4 @@ public void drop(DropTargetEvent event){};
public void dropAccept(DropTargetEvent event){};
-} \ No newline at end of file
+}
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
index 95a77d53f9..b4075892e5 100755
--- 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
@@ -1,9 +1,8 @@
package org.eclipse.swt.dnd;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.events.TypedEvent;
import org.eclipse.swt.widgets.Widget;
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
index acd9e09f69..1423674be1 100755
--- 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
@@ -1,9 +1,8 @@
package org.eclipse.swt.dnd;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.graphics.*;
import java.util.EventListener;
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
index 6cf7c6054c..d3d854a3e7 100755
--- 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
@@ -1,14 +1,14 @@
package org.eclipse.swt.dnd;
-import org.eclipse.swt.widgets.*;
-
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (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){}
-} \ No newline at end of file
+}
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
index 2f36647b51..e2adf9d6c8 100755
--- 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
@@ -5,9 +5,9 @@
<title>Package-level Javadoc</title>
</head>
<body>
-Brief overview will be provided here.
+SWT Drag and Drop support.
<h2>
Package Specification</h2>
-Detailed overview will be provided here.
+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/motif/org/eclipse/swt/dnd/ByteArrayTransfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/ByteArrayTransfer.java
index df1a8dd4b9..de4a1159a9 100755
--- 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
@@ -1,12 +1,22 @@
package org.eclipse.swt.dnd;
-import org.eclipse.swt.internal.motif.*;
-
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (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();
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
index a7c099fe60..424a799cc3 100755
--- 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
@@ -1,19 +1,17 @@
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.*;
-/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
- */
-
-/*
- *
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- *
+/**
+ * IMPORTANT: This class is <em>not</em> intended to be subclassed.
*/
public class Clipboard {
@@ -203,4 +201,4 @@ public String[] getAvailableTypeNames() {
}
return types;
}
-} \ No newline at end of file
+}
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
index db1d34e248..38b3e08568 100755
--- 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
@@ -1,78 +1,78 @@
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.*;
-/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
- */
-
-/**
- *
- * 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>
+/**
+ *
+ * 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 {
@@ -84,11 +84,20 @@ public class DragSource extends Widget {
private Control control;
private Listener controlListener;
private Transfer[] transferAgents = new Transfer[0];
-
- private boolean myDrag;
+
+ 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));
@@ -116,19 +125,16 @@ public DragSource(Control control, int style) {
}
});
}
-/**
-* 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
-*/
+/**
+ * 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);
@@ -166,6 +172,7 @@ private int convertProcCallback(int widget, int pSelection, int pTarget, int pTy
// 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);
@@ -240,13 +247,10 @@ private void drag() {
}
if (!event.doit) {
- int time = display.xEvent.pad2; // corresponds to time field in XButtonEvent
- int[] args = new int[]{ OS.XmNdragOperations, OS.XmDROP_NOOP};
+ int time = display.xEvent.pad2; // corresponds to time field in XButtonEvent
int dc = OS.XmGetDragContext(control.handle, time);
if (dc != 0){
- OS.XtSetValues(dc, args, args.length /2);
- } else {
- dc = OS.XmDragStart(this.control.handle, display.xEvent, args, args.length/2);
+ OS.XmDragCancel(dc);
}
return;
}
@@ -296,7 +300,6 @@ private void drag() {
OS.XtSetValues(dragContext, args, args.length /2);
} else {
dragContext = OS.XmDragStart(this.control.handle, display.xEvent, args, args.length / 2);
- myDrag = true;
}
OS.XtFree(pExportTargets);
if (dragContext == 0) return;
@@ -352,7 +355,16 @@ private int dropFinishCallback(int widget, int client_data, int call_data) {
DNDEvent event = new DNDEvent();
event.widget = this.control;
event.time = data.timeStamp;
- event.detail = osOpToOp(data.operation);
+ 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 {
@@ -360,8 +372,16 @@ private int dropFinishCallback(int widget, int client_data, int call_data) {
} 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;
}
@@ -373,15 +393,15 @@ 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() {
-
- // Check if there is a drag in progress and cancel it
- //if (dragContext != 0 && myDrag)
- // OS.XmDragCancel(dragContext);
-
if (convertProc != null)
convertProc.dispose();
convertProc = null;
@@ -426,25 +446,27 @@ private int osOpToOp(byte osOperation){
return operation;
}
-/**
-* 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
-*/
+/**
+ * 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;
}
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
index cdef0449d4..a69b24b776 100755
--- 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
@@ -1,66 +1,66 @@
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.*;
-/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
- */
-
-/**
- *
- * 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>
+/**
+ *
+ * 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 {
@@ -81,6 +81,15 @@ public class DropTarget extends Widget {
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));
@@ -99,7 +108,9 @@ public DropTarget(Control control, int style) {
OS.XmNdropSiteOperations, opToOsOp(style),
OS.XmNdropSiteActivity, OS.XmDROP_SITE_ACTIVE,
OS.XmNdropProc, dropProc.getAddress(),
- OS.XmNdragProc, dragProc.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.
@@ -131,19 +142,16 @@ public DropTarget(Control control, int style) {
effect = new NoDragUnderEffect(control);
}
}
-/**
-* 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
-*/
+/**
+ * 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);
@@ -332,12 +340,12 @@ private int dropProcCallback(int widget, int client_data, int call_data) {
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
- *
+/**
+ * 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;
@@ -347,11 +355,11 @@ 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
- *
+/**
+ * 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;
@@ -420,19 +428,16 @@ private void releaseDropInfo(){
droppedEventData = null;
dropTransferObject = 0;
}
-/**
-* 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
-*/
+/**
+ * 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);
@@ -442,6 +447,12 @@ public void removeDropListener(DropTargetListener 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;
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
index 8b70854312..0bda4b53f6 100755
--- 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
@@ -1,10 +1,13 @@
package org.eclipse.swt.dnd;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (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();
@@ -12,9 +15,33 @@ public class FileTransfer extends ByteArrayTransfer {
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;
@@ -31,6 +58,13 @@ public void javaToNative(Object object, TransferData transferData) {
// 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);
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
index af09aac900..f2b015d4b0 100755
--- 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
@@ -1,10 +1,14 @@
package org.eclipse.swt.dnd;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (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();
@@ -17,15 +21,46 @@ public class RTFTransfer extends ByteArrayTransfer {
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);
@@ -39,4 +74,4 @@ protected String[] getTypeNames(){
protected int[] getTypeIds(){
return new int[]{TYPEID1, TYPEID2, TYPEID3};
}
-} \ No newline at end of file
+}
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
index 231db14dc3..32199ff394 100755
--- 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
@@ -1,13 +1,13 @@
package org.eclipse.swt.dnd;
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.widgets.*;
-/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
- */
-
class TableDragUnderEffect extends DragUnderEffect {
private Table table;
private TableItem currentItem;
@@ -60,4 +60,4 @@ private void setDragUnderEffect(int effect, TableItem item) {
}
currentEffect = effect;
}
-} \ No newline at end of file
+}
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
index 12afd23a9d..93fb0cf71e 100755
--- 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
@@ -1,10 +1,13 @@
package org.eclipse.swt.dnd;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (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();
@@ -17,15 +20,46 @@ public class TextTransfer extends ByteArrayTransfer {
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);
@@ -39,4 +73,4 @@ protected String[] getTypeNames(){
protected int[] getTypeIds(){
return new int[]{TYPEID1, TYPEID2, TYPEID3};
}
-} \ No newline at end of file
+}
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
index 98f63bd8bc..9de9048d0e 100755
--- 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
@@ -1,21 +1,56 @@
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;
-/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 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){
int xDisplay = Display.getDefault().xDisplay; // using default because we don't have a particular widget
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
index a73cc97090..19562957a4 100755
--- 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
@@ -1,14 +1,31 @@
package org.eclipse.swt.dnd;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (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
+ /* attributes specific to set/get */
int length;
int format;
int pValue;
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
index e0babbfe6f..85ea33c175 100755
--- 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
@@ -1,13 +1,13 @@
package org.eclipse.swt.dnd;
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.widgets.*;
-/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
- */
-
class TreeDragUnderEffect extends DragUnderEffect {
private Tree tree;
@@ -36,16 +36,34 @@ void show(int effect, int x, int y) {
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;
- Rectangle area = tree.getClientArea();
for (int x1 = area.x; x1 < area.x + area.width; x1++) {
- coordinates = new Point(x1, y);
- coordinates = tree.toControl(coordinates);
+ 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) {
@@ -97,4 +115,4 @@ private void setDropSelection (TreeItem item) {
}
}
-} \ No newline at end of file
+}
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
index ec66fefb22..63f1eb6159 100755
--- 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
@@ -3,8 +3,8 @@ package org.eclipse.swt.dnd;
import org.eclipse.swt.internal.photon.*;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public abstract class ByteArrayTransfer extends Transfer {
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
index a51be325c3..bd8b75d483 100755
--- 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
@@ -6,8 +6,8 @@ import org.eclipse.swt.internal.photon.*;
import org.eclipse.swt.widgets.*;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
/*
@@ -91,4 +91,4 @@ public String[] getAvailableTypeNames() {
// }
return types;
}
-} \ No newline at end of file
+}
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
index ace4bd062c..ae0183a2b9 100755
--- 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
@@ -6,8 +6,8 @@ import org.eclipse.swt.internal.*;
import org.eclipse.swt.internal.photon.*;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
/**
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
index f5184be09b..7db51206c7 100755
--- 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
@@ -7,8 +7,8 @@ import org.eclipse.swt.internal.*;
import org.eclipse.swt.internal.photon.*;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
/**
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
index 8b70854312..54044a03f1 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.dnd;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class FileTransfer extends ByteArrayTransfer {
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
index af09aac900..d36e6562b0 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.dnd;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class RTFTransfer extends ByteArrayTransfer {
@@ -39,4 +39,4 @@ protected String[] getTypeNames(){
protected int[] getTypeIds(){
return new int[]{TYPEID1, TYPEID2, TYPEID3};
}
-} \ No newline at end of file
+}
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
index 231db14dc3..53f10ee2d7 100755
--- 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
@@ -4,8 +4,8 @@ import org.eclipse.swt.graphics.*;
import org.eclipse.swt.widgets.*;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
class TableDragUnderEffect extends DragUnderEffect {
@@ -60,4 +60,4 @@ private void setDragUnderEffect(int effect, TableItem item) {
}
currentEffect = effect;
}
-} \ No newline at end of file
+}
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
index 12afd23a9d..e6587940bc 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.dnd;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class TextTransfer extends ByteArrayTransfer {
@@ -39,4 +39,4 @@ protected String[] getTypeNames(){
protected int[] getTypeIds(){
return new int[]{TYPEID1, TYPEID2, TYPEID3};
}
-} \ No newline at end of file
+}
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
index be1aee9ab1..3634d3576d 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.dnd;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public abstract class Transfer {
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
index a73cc97090..50eabd10e9 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.dnd;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class TransferData {
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
index f78887e054..401c22a3e3 100755
--- 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
@@ -4,8 +4,8 @@ import org.eclipse.swt.graphics.*;
import org.eclipse.swt.widgets.*;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
class TreeDragUnderEffect extends DragUnderEffect {
@@ -99,4 +99,4 @@ private void setDropSelection (TreeItem item) {
private void setInsertMark (TreeItem item, boolean after) {
// not currently implemented
}
-} \ No newline at end of file
+}
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
index 8f819f1abe..86e486532d 100755
--- 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
@@ -1,9 +1,8 @@
package org.eclipse.swt.dnd;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.ole.win32.*;
import org.eclipse.swt.internal.win32.*;
@@ -17,7 +16,6 @@ import org.eclipse.swt.internal.win32.*;
* 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(){
@@ -49,17 +47,23 @@ public boolean isSupportedType(TransferData transferData){
return false;
}
/**
- *
- * Converts a Java byte array to a platform specific representation of the byte array.
- *
- * <p>On a successful conversion, the transferData.result field will be set to COM.S_OK.
- * If this transfer agent is unable to perform the conversion, the transferData.result field
- * will be set to the failure value of COM.DV_E_TYMED.</p>
+ * 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[])) {
@@ -89,13 +93,11 @@ protected void javaToNative (Object object, TransferData transferData){
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
- *
+ * @return a Java byte array containing the transferred data if the conversion was successful;
+ * otherwise null
*/
protected Object nativeToJava(TransferData transferData){
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
index 98310a4ba1..3e13a2b215 100755
--- 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
@@ -1,19 +1,17 @@
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.*;
-/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
- */
-
-/*
- *
+/**
* IMPORTANT: This class is <em>not</em> intended to be subclassed.
- *
*/
public class Clipboard {
@@ -354,4 +352,4 @@ public String[] getAvailableTypeNames() {
}
-} \ No newline at end of file
+}
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
index e3437522d0..113ff3f934 100755
--- 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
@@ -1,9 +1,8 @@
package org.eclipse.swt.dnd;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.*;
import org.eclipse.swt.ole.win32.*;
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
index ac988fc577..c12c26c2b0 100755
--- 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
@@ -1,9 +1,8 @@
package org.eclipse.swt.dnd;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.*;
import org.eclipse.swt.ole.win32.*;
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
index 1c98e5ad7e..0091126060 100755
--- 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
@@ -1,16 +1,13 @@
package org.eclipse.swt.dnd;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.ole.win32.*;
/**
- *
* The <code>FileTransfer</code> class is used to transfer files in a drag and drop operation.
- *
*/
public class FileTransfer extends ByteArrayTransfer {
@@ -18,28 +15,31 @@ 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 _instance;
}
/**
- *
- * Converts a list of file names to a platform specific representation of these file names.
- *
- * <p>On a successful conversion, the transferData.result field will be set to COM.S_OK.
- * If this transfer agent is unable to perform the conversion, the transferData.result field
- * will be set to the failure value of COM.DV_E_TYMED.</p>
+ * 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
- *
+ * with the platform specific format of the data
*/
public void javaToNative(Object object, TransferData transferData) {
@@ -74,13 +74,11 @@ public void javaToNative(Object object, TransferData transferData) {
super.javaToNative(buffer, 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
- *
+ * @return a Java array of String containing a list of file names if the conversion was successful;
+ * otherwise null
*/
public Object nativeToJava(TransferData transferData) {
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
index 0310b3b42a..80b8bc248b 100755
--- 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
@@ -1,9 +1,8 @@
package org.eclipse.swt.dnd;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.*;
import org.eclipse.swt.ole.win32.*;
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
index 5abdf1088f..3dba0b73db 100755
--- 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
@@ -1,16 +1,13 @@
package org.eclipse.swt.dnd;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (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 {
@@ -20,28 +17,31 @@ public class RTFTransfer extends ByteArrayTransfer {
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 Java String to a platform specific representation of the string.
- *
- * <p>On a successful conversion, the transferData.result field will be set to OLE.S_OK.
- * If this transfer agent is unable to perform the conversion, the transferData.result field
- * will be set to the failure value of OLE.DV_E_TYMED.</p>
+ * 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
- *
+ * with the platform specific format of the data
*/
public void javaToNative (Object object, TransferData transferData){
if (object == null || !(object instanceof String)) return;
@@ -53,13 +53,11 @@ public void javaToNative (Object object, TransferData transferData){
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
- *
+ * @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
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
index 5cd21361d0..4697b6b54e 100755
--- 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
@@ -1,15 +1,15 @@
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;
-/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
- */
-
class TableDragUnderEffect extends DragUnderEffect {
private Table table;
private TableItem currentItem;
@@ -58,4 +58,4 @@ private void setDropSelection (TableItem item) {
OS.SendMessage (table.handle, OS.LVM_SETITEMSTATE, index, lvItem);
}
}
-} \ No newline at end of file
+}
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
index 85dbdfbbe2..fe6e35dd80 100755
--- 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
@@ -1,44 +1,45 @@
package org.eclipse.swt.dnd;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.ole.win32.COM;
/**
- *
* 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 Java String to a platform specific representation of the string.
- *
- * <p>On a successful conversion, the transferData.result field will be set to OLE.S_OK.
- * If this transfer agent is unable to perform the conversion, the transferData.result field
- * will be set to the failure value of OLE.DV_E_TYMED.</p>
+ * 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
- *
+ * with the platform specific format of the data
*/
public void javaToNative (Object object, TransferData transferData){
if (object == null || !(object instanceof String)) return;
@@ -50,13 +51,11 @@ public void javaToNative (Object object, TransferData transferData){
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
- *
+ * @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
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
index 4556298271..113c23523e 100755
--- 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
@@ -1,9 +1,8 @@
package org.eclipse.swt.dnd;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.ole.win32.COM;
@@ -13,16 +12,15 @@ import org.eclipse.swt.internal.ole.win32.COM;
*
* <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();
/**
@@ -32,37 +30,44 @@ abstract public TransferData[] getSupportedTypes();
* 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 to OLE.S_OK.
- * If this transfer agent is unable to perform the conversion, the transferData.result field
- * will be set to the failure value of OLE.DV_E_TYMED.</p>
+ * <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 specfifc representation of the data
- *
+ * 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
- *
+ * @return a Java Object containing the transferred data if the conversion was successful;
+ * otherwise null
*/
-
- abstract protected Object nativeToJava(TransferData transferData);
+ abstract protected Object nativeToJava(TransferData transferData);
+
/**
* Registers a name for a data type and returns the associated unique identifier.
*
@@ -75,7 +80,6 @@ abstract protected String[] getTypeNames();
* @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
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
index 02a8c329fb..434a1682c6 100755
--- 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
@@ -1,14 +1,12 @@
package org.eclipse.swt.dnd;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (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.
*
@@ -20,30 +18,35 @@ import org.eclipse.swt.internal.ole.win32.*;
*
* <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
- * Windows specific format
+ * (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
index 5115aba9db..431a68dc7e 100755
--- 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
@@ -1,15 +1,14 @@
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;
-/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
- */
-
class TreeDragUnderEffect extends DragUnderEffect {
private Tree tree;
@@ -47,16 +46,35 @@ void show(int effect, int x, int y) {
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;
- Rectangle area = tree.getClientArea();
+ // Scan across the width of the tree.
for (int x1 = area.x; x1 < area.x + area.width; x1++) {
- coordinates = new Point(x1, y);
- coordinates = tree.toControl(coordinates);
+ 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) {
@@ -105,4 +123,4 @@ private void setDropSelection (TreeItem item) {
if (item != null) hNewItem = item.handle;
OS.SendMessage (tree.handle, OS.TVM_SELECTITEM, OS.TVIS_DROPHILITED, hNewItem);
}
-} \ No newline at end of file
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/CAUUID.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/CAUUID.java
index 1583e9dac0..7e471056c8 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/CAUUID.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/CAUUID.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.ole.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public final class CAUUID {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/COM.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/COM.java
index 1d5bd02e7c..427eacb70f 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/COM.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/COM.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.ole.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.win32.*;
@@ -19,7 +18,7 @@ public class COM extends OS {
/* Constants */
- // !!!! GUIDs for Home Page Browser !!!!
+ // 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}");
@@ -539,6 +538,7 @@ public static final native int VtblCall (int fnNumber, int ppVtbl, int arg0, GUI
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);
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
index bef6d7e995..9b34c80fd5 100755
--- 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
@@ -5,8 +5,8 @@ import org.eclipse.swt.internal.*;
import org.eclipse.swt.internal.win32.*;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class COMObject {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/CONTROLINFO.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/CONTROLINFO.java
index 08cfe9319a..b7581ed5d6 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/CONTROLINFO.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/CONTROLINFO.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.ole.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public final class CONTROLINFO
{
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/COSERVERINFO.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/COSERVERINFO.java
index 7177ca2654..72a3e944bc 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/COSERVERINFO.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/COSERVERINFO.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.ole.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class COSERVERINFO {
public int dwReserved1;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/DISPPARAMS.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/DISPPARAMS.java
index e55bcb0030..95ee285d78 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/DISPPARAMS.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/DISPPARAMS.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.ole.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public final class DISPPARAMS
{
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/DROPFILES.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/DROPFILES.java
index c34ffd0cbc..629677d076 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/DROPFILES.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/DROPFILES.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.ole.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (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.
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/DVTARGETDEVICE.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/DVTARGETDEVICE.java
index f5ae048ad2..f95abbfcac 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/DVTARGETDEVICE.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/DVTARGETDEVICE.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.ole.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public final class DVTARGETDEVICE
{
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/EXCEPINFO.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/EXCEPINFO.java
index ed85c472da..2f4ceda693 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/EXCEPINFO.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/EXCEPINFO.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.ole.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public final class EXCEPINFO
{
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/FORMATETC.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/FORMATETC.java
index 1b177e7044..5dc80509d4 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/FORMATETC.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/FORMATETC.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.ole.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public final class FORMATETC
{
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/FUNCDESC1.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/FUNCDESC1.java
index 50fddbb9cd..ed25a01c40 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/FUNCDESC1.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/FUNCDESC1.java
@@ -1,8 +1,8 @@
package org.eclipse.swt.internal.ole.win32;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class FUNCDESC1 {
@@ -29,4 +29,4 @@ public class FUNCDESC1 {
public static final int sizeof = 50;
-} \ No newline at end of file
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/FUNCDESC2.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/FUNCDESC2.java
index cba1125f53..501465932e 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/FUNCDESC2.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/FUNCDESC2.java
@@ -1,8 +1,8 @@
package org.eclipse.swt.internal.ole.win32;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class FUNCDESC2 {
@@ -29,4 +29,4 @@ public class FUNCDESC2 {
public static final int sizeof = 50;
-} \ No newline at end of file
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/GUID.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/GUID.java
index 2a3af7d23d..c11d9bd26f 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/GUID.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/GUID.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.ole.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public final class GUID
{
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IClassFactory2.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IClassFactory2.java
index ad71bed45f..8ddc0b578b 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IClassFactory2.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IClassFactory2.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.ole.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class IClassFactory2 extends IUnknown
{
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IConnectionPoint.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IConnectionPoint.java
index ee7dd708ea..5098b0e9b1 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IConnectionPoint.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IConnectionPoint.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.ole.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class IConnectionPoint extends IUnknown
{
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IConnectionPointContainer.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IConnectionPointContainer.java
index d4ce46a4d9..8eb4d505b1 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IConnectionPointContainer.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IConnectionPointContainer.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.ole.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class IConnectionPointContainer extends IUnknown
{
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IDataObject.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IDataObject.java
index e513252fe1..f362cc0100 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IDataObject.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IDataObject.java
@@ -1,15 +1,10 @@
package org.eclipse.swt.internal.ole.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class IDataObject extends IUnknown {
-/**
- * IDataObject constructor comment.
- * @param address int
- */
public IDataObject(int address) {
super(address);
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IDispatch.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IDispatch.java
index 171ce98771..e9dc3fa832 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IDispatch.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IDispatch.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.ole.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.win32.*;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IEnum.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IEnum.java
index eb1841b0cf..20bfa0d2e7 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IEnum.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IEnum.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.ole.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class IEnum extends IUnknown
{
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IEnumFORMATETC.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IEnumFORMATETC.java
index 7fb4fb70f4..86ef9e7204 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IEnumFORMATETC.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IEnumFORMATETC.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.ole.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class IEnumFORMATETC extends IEnum {
public IEnumFORMATETC(int address) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IEnumSTATSTG.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IEnumSTATSTG.java
index 3753815363..73f69c2667 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IEnumSTATSTG.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IEnumSTATSTG.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.ole.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class IEnumSTATSTG extends IEnum {
public IEnumSTATSTG(int address) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IFont.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IFont.java
index e0422317f6..1f113189f7 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IFont.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IFont.java
@@ -1,15 +1,10 @@
package org.eclipse.swt.internal.ole.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class IFont extends IUnknown {
-/**
- * IFont constructor comment.
- * @param address int
- */
public IFont(int address) {
super(address);
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IMoniker.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IMoniker.java
index 0fb02bb76d..50a7c9460d 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IMoniker.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IMoniker.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.ole.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class IMoniker extends IPersist
{
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IOleCommandTarget.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IOleCommandTarget.java
index be82303bfe..0d86e7f55b 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IOleCommandTarget.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IOleCommandTarget.java
@@ -1,15 +1,10 @@
package org.eclipse.swt.internal.ole.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class IOleCommandTarget extends IUnknown {
-/**
- * IOleCommandTarget constructor comment.
- * @param address int
- */
public IOleCommandTarget(int address) {
super(address);
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IOleControl.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IOleControl.java
index 169935b094..51f6c3df93 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IOleControl.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IOleControl.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.ole.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class IOleControl extends IUnknown
{
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IOleInPlaceActiveObject.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IOleInPlaceActiveObject.java
index ef0defed9e..da57f127f1 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IOleInPlaceActiveObject.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IOleInPlaceActiveObject.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.ole.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.win32.*;
@@ -12,6 +11,10 @@ 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 OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IOleInPlaceObject.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IOleInPlaceObject.java
index 5963096daa..d0c6cc4c61 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IOleInPlaceObject.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IOleInPlaceObject.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.ole.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.win32.*;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IOleLink.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IOleLink.java
index a84c3851a6..a676e8090e 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IOleLink.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IOleLink.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.ole.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class IOleLink extends IUnknown
{
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IOleObject.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IOleObject.java
index 1559123ad8..114232a932 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IOleObject.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IOleObject.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.ole.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.win32.*;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IOleWindow.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IOleWindow.java
index 1a7d21a3b5..acb1f61664 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IOleWindow.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IOleWindow.java
@@ -1,15 +1,10 @@
package org.eclipse.swt.internal.ole.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class IOleWindow extends IUnknown {
-/**
- * ProxyIOleWindow constructor comment.
- * @param address int
- */
public IOleWindow(int address) {
super(address);
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IPersist.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IPersist.java
index a8ed520f9e..44f30de396 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IPersist.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IPersist.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.ole.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class IPersist extends IUnknown
{
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IPersistStorage.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IPersistStorage.java
index e3a5f164ee..e11d8f971c 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IPersistStorage.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IPersistStorage.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.ole.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class IPersistStorage extends IPersist
{
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IProvideClassInfo.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IProvideClassInfo.java
index ecaa8db5dc..e6ae63f38b 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IProvideClassInfo.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IProvideClassInfo.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.ole.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class IProvideClassInfo extends IUnknown
{
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IProvideClassInfo2.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IProvideClassInfo2.java
index d82afd0a23..bcba483008 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IProvideClassInfo2.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IProvideClassInfo2.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.ole.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class IProvideClassInfo2 extends IProvideClassInfo
{
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/ISpecifyPropertyPages.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/ISpecifyPropertyPages.java
index 667cc850d6..4c73a077c2 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/ISpecifyPropertyPages.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/ISpecifyPropertyPages.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.ole.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class ISpecifyPropertyPages extends IUnknown {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IStorage.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IStorage.java
index 3324b33b4e..ad840e36e3 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IStorage.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IStorage.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.ole.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class IStorage extends IUnknown
{
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IStream.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IStream.java
index b4bff056b3..658d0d0bdc 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IStream.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IStream.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.ole.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class IStream extends IUnknown {
public IStream(int address) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/ITypeInfo.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/ITypeInfo.java
index 9135807800..c67a5069ef 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/ITypeInfo.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/ITypeInfo.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.ole.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.win32.OS;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IUnknown.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IUnknown.java
index 18e2e8df43..9e168f70ae 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IUnknown.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IUnknown.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.ole.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class IUnknown
{
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IViewObject2.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IViewObject2.java
index 78c2f621b3..7124f871e2 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IViewObject2.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/IViewObject2.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.ole.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.win32.*;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/LICINFO.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/LICINFO.java
index a427edd1b1..f4b54163b3 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/LICINFO.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/LICINFO.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.ole.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public final class LICINFO
{
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/OLECMD.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/OLECMD.java
index d51a8882e9..9ded930322 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/OLECMD.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/OLECMD.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.ole.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class OLECMD {
public int cmdID;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/OLECMDTEXT.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/OLECMDTEXT.java
index bfac57d0e2..ee5594b3e4 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/OLECMDTEXT.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/OLECMDTEXT.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.ole.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class OLECMDTEXT {
public int cmdtextf;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/OLEINPLACEFRAMEINFO.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/OLEINPLACEFRAMEINFO.java
index cc0bf1c086..7459b53de1 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/OLEINPLACEFRAMEINFO.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/OLEINPLACEFRAMEINFO.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.ole.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public final class OLEINPLACEFRAMEINFO
{
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/STATSTG.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/STATSTG.java
index 76a3a7de8e..abb2e3ea23 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/STATSTG.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/STATSTG.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.ole.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class STATSTG {
public int pwcsName;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/STGMEDIUM.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/STGMEDIUM.java
index cf9ecde696..edf791bf8a 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/STGMEDIUM.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/STGMEDIUM.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.ole.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public final class STGMEDIUM
{
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/TYPEATTR.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/TYPEATTR.java
index 4055e2fbeb..f127ba3939 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/TYPEATTR.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/TYPEATTR.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.ole.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public final class TYPEATTR
{
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/VARDESC1.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/VARDESC1.java
index 9d33d3f54a..1f5d9cf023 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/VARDESC1.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/VARDESC1.java
@@ -1,8 +1,8 @@
package org.eclipse.swt.internal.ole.win32;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class VARDESC1 {
@@ -23,4 +23,4 @@ public class VARDESC1 {
public int varkind;
public static final int sizeof = 36;
-} \ No newline at end of file
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/VARDESC2.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/VARDESC2.java
index 7237ffce2d..a422c5f454 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/VARDESC2.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/VARDESC2.java
@@ -1,8 +1,8 @@
package org.eclipse.swt.internal.ole.win32;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class VARDESC2 {
@@ -23,4 +23,4 @@ public class VARDESC2 {
public int varkind;
public static final int sizeof = 36;
-} \ No newline at end of file
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/package.html b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/package.html
index 2f36647b51..1c2f7fe7d9 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/package.html
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/package.html
@@ -5,9 +5,16 @@
<title>Package-level Javadoc</title>
</head>
<body>
-Brief overview will be provided here.
+SWT internal Win32 OLE implementation classes.
<h2>
Package Specification</h2>
-Detailed overview will be provided here.
+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 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
index 2ad984837b..dd6d8e87d8 100755
--- 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
@@ -1,9 +1,8 @@
package org.eclipse.swt.ole.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.*;
import java.io.File;
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
index 1ac00551fe..840ea96247 100755
--- 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
@@ -1,20 +1,14 @@
package org.eclipse.swt.ole.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (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.*;
-/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
- */
/**
* OleAutomation provides a generic mechanism for accessing functionality that is
* specific to a particular ActiveX Control or OLE Document.
@@ -192,11 +186,15 @@ public OleFunctionDescription getFunctionDescription(int index) {
data.helpFile = getHelpFile(funcdesc.memid);
String[] names = getNames(funcdesc.memid, funcdesc.cParams + 1);
- data.name = names[0];
+ 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();
- data.args[i].name = names[i + 1];
+ 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) {
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
index bf6dc38b03..2c85d77347 100755
--- 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
@@ -1,9 +1,8 @@
package org.eclipse.swt.ole.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import java.io.File;
import java.io.FileInputStream;
@@ -30,6 +29,10 @@ import org.eclipse.swt.internal.win32.*;
* <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
@@ -730,22 +733,38 @@ private int GetWindowContext(int ppFrame, int ppDoc, int lprcPosRect, int lprcCl
frameInfo.cb = OLEINPLACEFRAMEINFO.sizeof;
frameInfo.fMDIApp = 0;
frameInfo.hwndFrame = frame.handle;
- //frameInfo.cAccelEntries = ??;
- //frameInfo.hAccel = ??;
+ Menu menubar = frame.getMenubar();
+ if (menubar != null && !menubar.isDisposed()) {
+ Shell shell = menubar.getShell();
+ 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 false;
+ 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();
- return (result == COM.S_OK);
+ if (result == COM.S_FALSE) return false;
+ return true;
}
public boolean isFocusControl () {
Control focus = getDisplay().getFocusControl();
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
index 42ed034b2f..f7d5fbb0b8 100755
--- 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
@@ -1,9 +1,8 @@
package org.eclipse.swt.ole.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import java.io.*;
import org.eclipse.swt.*;
@@ -25,6 +24,10 @@ import org.eclipse.swt.internal.win32.*;
*
* <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
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
index b38fc1eda2..0b9fe629e7 100755
--- 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
@@ -1,12 +1,12 @@
package org.eclipse.swt.ole.win32;
-import org.eclipse.swt.widgets.Widget;
-
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
+import org.eclipse.swt.widgets.Widget;
+
public class OleEvent {
public int type;
public Widget widget;
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
index 0668e40c92..5a8ce28281 100755
--- 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
@@ -1,9 +1,8 @@
package org.eclipse.swt.ole.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.*;
import org.eclipse.swt.internal.ole.win32.*;
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
index 6318e9d1b0..dca941fd32 100755
--- 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
@@ -1,12 +1,10 @@
package org.eclipse.swt.ole.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
-/* Imports */
import java.util.EventListener;
/**
@@ -17,7 +15,6 @@ import java.util.EventListener;
*
*/
-/* Class Definition */
class OleEventTable {
int [] types;
OleListener [] handlers;
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
index 8564bcea56..5691c8859c 100755
--- 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
@@ -1,9 +1,8 @@
package org.eclipse.swt.ole.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import java.io.*;
import org.eclipse.swt.*;
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
index d36adaa5e2..87d4432ebc 100755
--- 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
@@ -1,15 +1,15 @@
package org.eclipse.swt.ole.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (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;
@@ -68,6 +68,8 @@ final public class OleFrame extends Composite
}
private static String CHECK_FOCUS = "OLE_CHECK_FOCUS";
+ private static String HHOOK = "OLE_HHOOK";
+ private static String CALLBACK = "OLE_CALLBACK";
/**
* Create an OleFrame child widget using style bits
@@ -107,20 +109,21 @@ public OleFrame(Composite parent, int style) {
this.AddRef();
// Check for focus change
- checkFocus(getDisplay());
+ Display display = getDisplay();
+ initCheckFocus(display);
+ initMsgHook(display);
}
-private static void checkFocus (final Display display) {
- Object polling = display.getData(CHECK_FOCUS);
- if (polling != null) return;
+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() {
- Event event = new Event();
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];
@@ -152,6 +155,58 @@ private static void checkFocus (final Display display) {
};
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(CALLBACK, callback);
+ 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 = new MSG();
+ 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)) {
+ return 0;
+ }
+ }
+ }
+ }
+ }
+ return OS.CallNextHookEx(hHook.intValue(), code, wParam, lParam);
+}
/**
* Increment the count of references to this instance
*
@@ -620,7 +675,22 @@ private void setMenubar(Menu bar){
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){
- return COM.E_NOTIMPL;
+ 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
index 6ea8d8b923..1e4c6a0c28 100755
--- 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
@@ -1,12 +1,12 @@
package org.eclipse.swt.ole.win32;
-import org.eclipse.swt.internal.ole.win32.COM;
-
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
+import org.eclipse.swt.internal.ole.win32.COM;
+
public class OleFunctionDescription {
public int id;
@@ -21,4 +21,4 @@ public class OleFunctionDescription {
public String documentation;
public String helpFile;
-} \ No newline at end of file
+}
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
index 111bed3bc5..2fd261d9ab 100755
--- 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
@@ -1,9 +1,8 @@
package org.eclipse.swt.ole.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
/**
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
index 797c891085..69bb5c997a 100755
--- 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
@@ -1,12 +1,12 @@
package org.eclipse.swt.ole.win32;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class OleParameterDescription {
public String name;
public short flags;
public short type;
-} \ No newline at end of file
+}
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
index 4a4a84b75a..f87d36437f 100755
--- 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
@@ -1,13 +1,13 @@
package org.eclipse.swt.ole.win32;
-import org.eclipse.swt.internal.ole.win32.*;
-import org.eclipse.swt.*;
-
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (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;
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
index e07b151c78..515a485f65 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.ole.win32;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class OlePropertyDescription {
@@ -13,4 +13,4 @@ public class OlePropertyDescription {
public int kind;
public String description;
public String helpFile;
-} \ No newline at end of file
+}
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
index e9a39b00c5..079d0b23b3 100755
--- 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
@@ -1,9 +1,8 @@
package org.eclipse.swt.ole.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.*;
import org.eclipse.swt.internal.ole.win32.*;
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
index 2f36647b51..740fc1e68e 100755
--- 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
@@ -5,9 +5,15 @@
<title>Package-level Javadoc</title>
</head>
<body>
-Brief overview will be provided here.
+SWT Win32 OLE implementation classes.
<h2>
Package Specification</h2>
-Detailed overview will be provided here.
+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 Printing/common/org/eclipse/swt/printing/PrinterData.java b/bundles/org.eclipse.swt/Eclipse SWT Printing/common/org/eclipse/swt/printing/PrinterData.java
index 95c9419789..e0aaf4cc38 100755
--- 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
@@ -1,5 +1,10 @@
package org.eclipse.swt.printing;
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
import org.eclipse.swt.graphics.*;
/**
@@ -155,4 +160,4 @@ public final class PrinterData extends DeviceData {
public String toString() {
return "PrinterData {" + "driver = " + driver + ", name = " + name + "}";
}
-} \ No newline at end of file
+}
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
index 52216655f0..8504b5e5a5 100755
--- 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
@@ -5,9 +5,9 @@
<title>Package-level Javadoc</title>
</head>
<body>
-Brief overview will be provided here.
+SWT Printing support classes.
<h2>
Package Specification</h2>
-Detailed overview will be provided here.
+This package contains the classes which provide printing support for SWT.
</body>
</html>
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
index 0defeee996..feb6fe6c54 100755
--- 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
@@ -1,48 +1,190 @@
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);
}
+/**
+ * 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;
}
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
index d5b306051a..b3685e7048 100755
--- 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
@@ -1,15 +1,50 @@
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;
int defaultFontList;
+/**
+ * Returns an array of <code>PrinterData</code> objects
+ * representing all available printers.
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_UNSPECIFIED - if there are no valid printers
+ * </ul>
+ *
+ * @return the list of available printers
+ */
public static PrinterData[] getPrinterList() {
SWT.error(SWT.ERROR_NOT_IMPLEMENTED);
/* Connect to the default X print server */
@@ -61,10 +96,38 @@ static PrinterData getDefaultPrinterData() {
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);
}
@@ -118,6 +181,21 @@ protected void destroy() {
//if (xDisplay != 0) OS.XCloseDisplay(xDisplay);
}
+/**
+ * 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);
@@ -132,10 +210,45 @@ public int internal_new_GC(GCData data) {
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();
byte [] buffer = Converter.wcsToMbcs(null, "*job-name: " + jobName, true);
@@ -153,28 +266,86 @@ 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() {
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();
byte [] buffer = Converter.wcsToMbcs(null, "default-printer-resolution", true);
@@ -205,6 +376,19 @@ public Point getDPI() {
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();
@@ -214,6 +398,21 @@ public Rectangle getBounds() {
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();
@@ -221,6 +420,32 @@ public Rectangle getClientArea() {
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();
@@ -232,6 +457,14 @@ public Rectangle computeTrim(int x, int y, int width, int height) {
return new Rectangle(x - rect.x, y - rect.y, width + hTrim, height + vTrim);
}
+/**
+ * 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
+ */
public PrinterData getPrinterData() {
return data;
}
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
new file mode 100755
index 0000000000..2f6ed12c15
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT Printing/photon/org/eclipse/swt/printing/PrintDialog.java
@@ -0,0 +1,56 @@
+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.*;
+
+public class PrintDialog extends Dialog {
+ int scope = PrinterData.ALL_PAGES;
+ int startPage = -1, endPage = -1;
+ boolean printToFile = false;
+
+public PrintDialog (Shell parent) {
+ this (parent, SWT.PRIMARY_MODAL);
+}
+public PrintDialog (Shell parent, int style) {
+ super (parent, style);
+}
+public PrinterData open() {
+ /* Return the first printer in the list */
+ PrinterData[] printers = Printer.getPrinterList();
+ if (printers.length > 0) return printers[0];
+ return null;
+}
+public int getScope() {
+ return scope;
+}
+public void setScope(int scope) {
+ this.scope = scope;
+}
+public int getStartPage() {
+ return startPage;
+}
+public void setStartPage(int startPage) {
+ this.startPage = startPage;
+}
+public int getEndPage() {
+ return endPage;
+}
+public void setEndPage(int endPage) {
+ this.endPage = endPage;
+}
+public boolean getPrintToFile() {
+ return printToFile;
+}
+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
new file mode 100755
index 0000000000..5e4b1952e0
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT Printing/photon/org/eclipse/swt/printing/Printer.java
@@ -0,0 +1,86 @@
+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.*;
+
+public final class Printer extends Device {
+ PrinterData data;
+ int printContext, xScreen, xDrawable;
+ int defaultFontList;
+
+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];
+}
+
+public Printer() {
+ this(getDefaultPrinterData());
+}
+
+public Printer(PrinterData data) {
+ super(data);
+}
+
+
+public int internal_new_GC(GCData data) {
+ return 0;
+}
+
+public void internal_dispose_GC(int xGC, GCData data) {
+}
+
+public boolean startJob(String jobName) {
+ return true;
+}
+
+public void endJob() {
+}
+
+public void cancelJob() {
+}
+
+public boolean startPage() {
+ return true;
+}
+
+public void endPage() {
+}
+
+public Point getDPI() {
+ return new Point(0, 0);
+}
+
+public Rectangle getBounds() {
+ return null;
+}
+
+public Rectangle getClientArea() {
+ return null;
+}
+
+public Rectangle computeTrim(int x, int y, int width, int height) {
+ return new Rectangle(0,0,0,0);
+}
+
+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
index b85b43d811..b4aea6212a 100755
--- 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
@@ -1,5 +1,10 @@
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.*;
@@ -251,4 +256,4 @@ public PrinterData open() {
}
return null;
}
-} \ No newline at end of file
+}
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
index 0d6f3eadc7..4554b3c30f 100755
--- 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
@@ -1,5 +1,10 @@
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.*;
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
index 2f36647b51..25df82ce32 100755
--- 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
@@ -5,9 +5,10 @@
<title>Package-level Javadoc</title>
</head>
<body>
-Brief overview will be provided here.
+SWT Program support class.
<h2>
Package Specification</h2>
-Detailed overview will be provided here.
+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/motif/org/eclipse/swt/program/Program.java b/bundles/org.eclipse.swt/Eclipse SWT Program/motif/org/eclipse/swt/program/Program.java
index 6c3ac83605..52f5f9b5f4 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.program;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.*;
@@ -17,10 +17,10 @@ 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.
+/**
+ * Instances of this class represent programs and
+ * their assoicated file extensions in the operating
+ * system.
*/
public final class Program {
String name;
@@ -592,9 +592,11 @@ public boolean execute (String fileName) {
int fileArg = -1;
int index;
for (index=0; index < args.length; index++) {
- if (args[ index ].equals( "%f" )) {
+ int j = args[ index ].indexOf( "%f" );
+ if (j != -1) {
+ String value = args[ index ];
fileArg = index;
- args[ index ] = fileName;
+ args[ index ] = value.substring(0,j) + fileName + value.substring(j+2);
}
}
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
index 1756ecb143..319ecc5547 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.program;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.*;
@@ -166,4 +166,4 @@ public String toString () {
return "Program {" + name + "}";
}
-} \ No newline at end of file
+}
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
index 259670d42c..46925c3dc7 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.program;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.*;
@@ -200,12 +200,23 @@ public static boolean launch (String fileName) {
*/
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) return false;
- String prefix = command.substring (0, index);
- String suffix = command.substring (index + 2, command.length ());
+ 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 {
- Runtime.getRuntime ().exec (prefix + '"' + fileName + '"' + suffix);
+ Runtime.getRuntime ().exec (prefix + fileName + suffix);
} catch (IOException e) {
return false;
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/library/callback.c b/bundles/org.eclipse.swt/Eclipse SWT/common/library/callback.c
index 565483b589..5e98e3ca6a 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/library/callback.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT/common/library/callback.c
@@ -1,3 +1,8 @@
+/*
+ * (c) Copyright IBM Corp., 2000, 2001
+ * All Rights Reserved.
+ */
+
/**
* Callback implementation.
*/
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/library/callback.h b/bundles/org.eclipse.swt/Eclipse SWT/common/library/callback.h
index 9c0e042ca8..6c03643932 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/library/callback.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT/common/library/callback.h
@@ -1,3 +1,8 @@
+/*
+ * (c) Copyright IBM Corp., 2000, 2001
+ * All Rights Reserved.
+ */
+
/**
* Callback implementation.
*/
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/library/globals.c b/bundles/org.eclipse.swt/Eclipse SWT/common/library/globals.c
index 066c1d7052..b3ae1b8178 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/library/globals.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT/common/library/globals.c
@@ -1,3 +1,8 @@
+/*
+ * (c) Copyright IBM Corp., 2000, 2001
+ * All Rights Reserved.
+ */
+
/**
* globals.c
*
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/library/globals.h b/bundles/org.eclipse.swt/Eclipse SWT/common/library/globals.h
index 8cae65979b..dd6ccb871a 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/library/globals.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT/common/library/globals.h
@@ -1,3 +1,8 @@
+/*
+ * (c) Copyright IBM Corp., 2000, 2001
+ * All Rights Reserved.
+ */
+
/**
* globals.h
*
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/library/library.h b/bundles/org.eclipse.swt/Eclipse SWT/common/library/library.h
index 31f7bb92a4..1147e3ddfe 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/library/library.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT/common/library/library.h
@@ -1,3 +1,8 @@
+/*
+ * (c) Copyright IBM Corp., 2000, 2001
+ * All Rights Reserved.
+ */
+
/**
* library.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
index 1ace85cf6c..781e40e9e7 100755
--- 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
@@ -1,12 +1,13 @@
package org.eclipse.swt;
-import org.eclipse.swt.internal.*;
-
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
+import java.util.*;
+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
@@ -823,7 +824,7 @@ public class SWT {
/**
* <code>MessageBox</code> style constant for "working" icon
- * behavior (value is 1<<1)
+ * behavior (value is 1<<4)
*/
public static final int ICON_WORKING = 1 << 4;
@@ -1302,7 +1303,7 @@ public class SWT {
* information see the comment in <code>Widget.checkSubclass()</code>
* (value is 43)
*
- * @see Widget#checkSubclass
+ * @see org.eclipse.swt.widgets.Widget#checkSubclass
*/
public static final int ERROR_INVALID_SUBCLASS = 43;
@@ -1678,8 +1679,41 @@ static String findErrorText (int code) {
return "Unknown error";
}
+private static ResourceBundle msgs = null;
+
+/**
+ * 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) {
+ String answer = key;
+
+ if (key == null) {
+ error (ERROR_NULL_ARGUMENT);
+ }
+ if (msgs == null) {
+ try {
+ msgs = ResourceBundle.getBundle("org.eclipse.swt.SWTMessages");
+ } catch (MissingResourceException ex) {
+ answer = key + " (no resource bundle)";
+ }
+ }
+ if (msgs != null) {
+ try {
+ answer = msgs.getString(key);
+ } catch (MissingResourceException ex2) {}
+ }
+ return answer;
+}
+
/**
- * Answers the SWT platform name.
+ * Returns the SWT platform name.
* Examples: "win32", "motif", "gtk", "photon"
*
* @return the SWT version number
@@ -1689,7 +1723,7 @@ public static String getPlatform () {
}
/**
- * Answers the SWT version number as an integer.
+ * Returns the SWT version number as an integer.
* Example: "SWT051" == 51
*
* @return the SWT version number
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
index 5dd494f2db..a707b9dc2f 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
/**
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
index 7f04b7c9fd..41d6aa7715 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
/**
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/SWTMessages.properties b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/SWTMessages.properties
new file mode 100755
index 0000000000..fa59d95297
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/SWTMessages.properties
@@ -0,0 +1,16 @@
+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/org/eclipse/swt/events/ArmEvent.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/ArmEvent.java
index 339b4de0c2..bcf47de09e 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.events;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.widgets.Event;
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
index 44dda803cc..46d7fe5233 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.events;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import java.util.EventListener;
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
index 231baa31fb..38551bc270 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.events;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
/**
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
index 22af9a8e0f..8285307a51 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.events;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.widgets.Event;
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
index 63ca027961..8f8ebcf95c 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.events;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import java.util.EventListener;
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
index 2bcac89d4e..42c50f72fc 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.events;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.widgets.Event;
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
index 586a3f467f..45fa5c032a 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.events;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import java.util.EventListener;
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
index d3e04295ec..2864339bc8 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.events;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
/**
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
index 997d6d81fa..2e14985163 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.events;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.widgets.Event;
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
index d0c16d1244..41736134a2 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.events;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import java.util.EventListener;
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
index d8a1666022..81ad33e31a 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.events;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.widgets.Event;
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
index bfd2c6587f..44edd2afd6 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.events;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import java.util.EventListener;
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
index fda909927f..7a865a969c 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.events;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
/**
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
index 876c9a50c4..1869b340c4 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.events;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.widgets.Event;
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
index 84b4cd1219..988125ae3f 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.events;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import java.util.EventListener;
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
index 14fe8a5f32..428ebc43c4 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.events;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
/**
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
index c0a144000f..ae6af6dc1b 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.events;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.widgets.Event;
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
index d88f93245d..9f9a837af3 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.events;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import java.util.EventListener;
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
index b71249856a..2ca717d10a 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.events;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.widgets.Event;
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
index e95b010440..e4da14c48a 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.events;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import java.util.EventListener;
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
index 3b10ac7b45..6f7b1c377f 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.events;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
/**
@@ -27,7 +27,7 @@ public abstract class MouseAdapter implements MouseListener {
*
* @param e an event containing information about the mouse double click
*
- * @see Display#getDoubleClickTime
+ * @see org.eclipse.swt.widgets.Display#getDoubleClickTime
*/
public void mouseDoubleClick(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
index eed4fbf8cc..d56a77c8c5 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.events;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.widgets.Event;
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
index dc86605ff6..185de9ac6d 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.events;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import java.util.EventListener;
@@ -31,7 +31,7 @@ public interface MouseListener extends EventListener {
*
* @param e an event containing information about the mouse double click
*
- * @see Display#getDoubleClickTime
+ * @see org.eclipse.swt.widgets.Display#getDoubleClickTime
*/
public void mouseDoubleClick(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
index 39a07d16f5..6302053d56 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.events;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import java.util.EventListener;
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
index 40e7e21888..dad082237d 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.events;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
/**
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
index 6ed12dbfbe..8eac067faf 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.events;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import java.util.EventListener;
@@ -50,4 +50,4 @@ public void mouseExit(MouseEvent e);
* @param e an event containing information about the hover
*/
public void mouseHover(MouseEvent e);
-} \ No newline at end of file
+}
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
index 2d25d9d2d2..51cacfe55d 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.events;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.widgets.Event;
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
index af30ca399d..c1ab6bd003 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.events;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import java.util.EventListener;
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
index 7dec1624a1..8724e9c9fa 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.events;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
/**
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
index d86a6dbf66..c33c9d10a7 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.events;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.widgets.Event;
@@ -51,6 +51,12 @@ public class SelectionEvent extends TypedEvent {
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;
@@ -69,6 +75,7 @@ public SelectionEvent(Event e) {
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
index a65a2fc88b..7b16986827 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.events;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import java.util.EventListener;
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
index 567187ff2d..93a6fb85ff 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.events;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
/**
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
index c73d2a067b..6273f8de22 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.events;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.widgets.Event;
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
index ee4f76cca6..c5c1e86440 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.events;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import java.util.EventListener;
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
index 26e378a961..9cd752f8d8 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.events;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.widgets.Event;
@@ -38,4 +38,4 @@ public TraverseEvent(Event e) {
this.detail = e.detail;
}
-} \ No newline at end of file
+}
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
index f78fcdb0eb..38ee3285b3 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.events;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import java.util.EventListener;
@@ -37,4 +37,4 @@ public interface TraverseListener extends EventListener {
* @param e an event containing information about the traverse
*/
public void keyTraversed(TraverseEvent e);
-} \ No newline at end of file
+}
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
index f6c6d6867d..7c1cd12e4d 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.events;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
/**
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
index eb64963477..a930b8773e 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.events;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.widgets.Event;
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
index 77b0cdce84..44c625ff29 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.events;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import java.util.EventListener;
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
index 19b53c21ef..a862f771a4 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.events;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.widgets.*;
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
index 40aaa43e8d..e90f60701f 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.events;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.widgets.Event;
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
index b2d18ad8fc..59906669ba 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.events;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import java.util.EventListener;
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
index 08a180c95e..77c36fdefc 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.graphics;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public interface Drawable {
@@ -42,4 +42,4 @@ public int internal_new_GC (GCData data);
*/
public void internal_dispose_GC (int handle, GCData data);
-} \ No newline at end of file
+}
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
index cc455ff417..b8747c68bd 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.graphics;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import java.io.*;
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
index c76db0d497..1528cf33db 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.graphics;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import java.io.*;
@@ -281,4 +281,4 @@ public void notifyListeners(ImageLoaderEvent event) {
}
}
-} \ No newline at end of file
+}
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
index 737582344c..614a97b341 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.graphics;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import java.util.*;
@@ -75,4 +75,4 @@ public String toString () {
return "ImageLoaderEvent {source=" + source + " imageData=" + imageData + " incrementCount=" + incrementCount + " endOfImage=" + endOfImage + "}";
}
-} \ No newline at end of file
+}
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
index a1ba7f2727..808c6d8677 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.graphics;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import java.util.EventListener;
@@ -36,4 +36,4 @@ public interface ImageLoaderListener extends EventListener {
*/
public void imageDataLoaded(ImageLoaderEvent e);
-} \ No newline at end of file
+}
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
index 91ef2bb4fe..cd2d3596ec 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.graphics;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.*;
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
index 64251fec65..f4acc565ba 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.graphics;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import java.io.Serializable;
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
index 7437c7c4d7..50ee5806c2 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.graphics;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import java.io.Serializable;
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
index 42b2f030cc..16d01bd900 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.graphics;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import java.io.Serializable;
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
index 3dc9ef89d6..412fb6f066 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.internal;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.*;
@@ -36,7 +36,7 @@ public class Callback {
/**
* SWT Minor version number (must be in the range 0..999)
*/
- public static int MINOR_VERSION = 105;
+ public static int MINOR_VERSION = 125;
/**
* SWT revision number (must be >= 0)
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
index 1bf2ae1d80..8610057e0f 100755
--- 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
@@ -1,17 +1,14 @@
package org.eclipse.swt.internal.image;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
-/* Imports */
import java.io.*;
import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
-/* Class Definition */
public abstract class FileFormat {
LEDataInputStream inputStream;
LEDataOutputStream outputStream;
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
index 5951beb747..055a6d56f3 100755
--- 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
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.image;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.*;
@@ -158,7 +157,7 @@ final class GIFFileFormat extends FileFormat {
}
id = readID();
}
- if (id == GIF_IMAGE_BLOCK_ID) {
+ if (id == GIF_IMAGE_BLOCK_ID || id == GIF_TRAILER_ID) {
try {
inputStream.unread(new byte[] {(byte)id});
} catch (IOException 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
index f211bfd3ca..074cd7d3ac 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.internal.image;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.*;
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
index 689ba2c5a8..0bfd486f7a 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.internal.image;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
final class JPEGArithmeticConditioningTable extends JPEGVariableSizeSegment {
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
index 7c2e186df0..9c5f46b9bc 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.internal.image;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
final class JPEGComment extends JPEGVariableSizeSegment {
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
index 2937a7cbe2..7aa67b6cdf 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.internal.image;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
final class JPEGEndOfImage extends JPEGFixedSizeSegment {
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
index 6650760172..dd067c73bf 100755
--- 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
@@ -1,17 +1,14 @@
package org.eclipse.swt.internal.image;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
-/* Imports */
import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
import java.io.*;
-/* Class Definition */
final class JPEGFileFormat extends FileFormat {
int restartInterval;
JPEGFrameHeader frameHeader;
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
index 9bf9191e51..98b8c1c0fc 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.internal.image;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.*;
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
index be2cf6c6d3..56cee0010d 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.internal.image;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.*;
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
index fc50d691e9..190b3164e2 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.internal.image;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
/**
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
index 47405a44c6..dbe8092880 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.internal.image;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
final class JPEGQuantizationTable extends JPEGVariableSizeSegment {
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
index 242d5d924d..fe439a5d04 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.internal.image;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
final class JPEGRestartInterval extends JPEGFixedSizeSegment {
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
index 4e087fb951..a4778fd8aa 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.internal.image;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.*;
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
index 4f41a6a98b..ab5dda1157 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.internal.image;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.*;
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
index 4a487d421b..b8ef25c1a3 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.internal.image;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
final class JPEGStartOfImage extends JPEGFixedSizeSegment {
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
index 7b96ed1aac..cafb98740e 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.internal.image;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.*;
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
index 46e843d4c0..20905a2be0 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.internal.image;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import java.io.*;
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
index 7859012ca8..16a52f1ff6 100755
--- 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
@@ -1,15 +1,12 @@
package org.eclipse.swt.internal.image;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
-/* Imports */
import java.io.*;
-/* Class Definition */
final class LEDataOutputStream extends OutputStream {
OutputStream out;
public LEDataOutputStream(OutputStream output) {
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
index fcf71f81a9..184d43f057 100755
--- 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
@@ -1,16 +1,13 @@
package org.eclipse.swt.internal.image;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
-/* Imports */
import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
-/* Class Definition */
final class LZWCodec {
int bitsPerPixel, blockSize, blockIndex, currentByte, bitsLeft,
codeSize, clearCode, endCode, newCodes, topSlot, currentSlot,
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
index d4d3d4b680..4e41f73259 100755
--- 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
@@ -1,12 +1,10 @@
package org.eclipse.swt.internal.image;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
-/* Class Definition */
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
index 6a9413bdb9..2dd958778e 100755
--- 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
@@ -1,15 +1,15 @@
package org.eclipse.swt.internal.image;
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
import java.io.*;
import java.util.*;
import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
-/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
- */
public class PNGFileFormat extends FileFormat {
static final int SIGNATURE_LENGTH = 8;
PngDecodingDataStream decodingStream;
@@ -171,7 +171,13 @@ void setPixelData(byte[] data, ImageData imageData) {
int width = imageData.width;
int height = imageData.height;
int destBytesPerLine = imageData.bytesPerLine;
- int srcBytesPerLine = width * 2;
+ /*
+ * 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++) {
@@ -200,6 +206,12 @@ void setPixelData(byte[] data, ImageData imageData) {
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++) {
@@ -522,4 +534,4 @@ void filterRow(byte[] row, byte[] previousRow, int filterType) {
}
}
-} \ No newline at end of file
+}
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
index 1715ebccb1..90c6f27d79 100755
--- 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
@@ -1,13 +1,13 @@
package org.eclipse.swt.internal.image;
-import org.eclipse.swt.*;
-import java.io.*;
-
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
+import org.eclipse.swt.*;
+import java.io.*;
+
class PngChunk extends Object {
byte[] reference;
@@ -330,4 +330,4 @@ public String toString() {
return buffer.toString();
}
-} \ No newline at end of file
+}
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
index f93b716697..48a9adb86b 100755
--- 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
@@ -1,12 +1,12 @@
package org.eclipse.swt.internal.image;
-import org.eclipse.swt.*;
-
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
+import org.eclipse.swt.*;
+
public class PngChunkReader {
LEDataInputStream inputStream;
PngFileReadState readState;
@@ -61,4 +61,4 @@ boolean hasMoreChunks() {
return !readState.readIEND;
}
-} \ No newline at end of file
+}
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
index 1800a2415b..e1e6b5d08c 100755
--- 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
@@ -1,13 +1,13 @@
package org.eclipse.swt.internal.image;
-import java.io.*;
-import org.eclipse.swt.*;
-
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
+import java.io.*;
+import org.eclipse.swt.*;
+
public class PngDecodingDataStream {
PngIdatChunk currentChunk;
PngChunkReader chunkReader;
@@ -103,7 +103,7 @@ private void readCompressedDataHeader() {
byte headerByte1 = getNextIdatByte();
byte headerByte2 = getNextIdatByte();
- int number = (headerByte1 << 8) | (headerByte2 & 0xFF);
+ int number = ((headerByte1 & 0xFF) << 8) | (headerByte2 & 0xFF);
if (number % 31 != 0) error();
int compressionMethod = headerByte1 & 0x0F;
@@ -128,4 +128,4 @@ void checkAdler() {
if (storedAdler != adlerValue) error();
}
-} \ No newline at end of file
+}
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
index 13e23783f3..88778d4617 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.internal.image;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
class PngFileReadState extends Object {
@@ -17,4 +17,4 @@ class PngFileReadState extends Object {
// Set to true after IDATs have been read.
boolean readPixelData;
-} \ No newline at end of file
+}
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
index 5c5eafa9a7..f751ff7c1a 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.internal.image;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class PngHuffmanTable {
@@ -119,4 +119,4 @@ class CodeLengthInfo {
int baseIndex;
}
-} \ No newline at end of file
+}
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
index 383323da97..cb1ed09fa8 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.internal.image;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class PngHuffmanTables {
@@ -153,4 +153,4 @@ int getNextDistanceValue(PngDecodingDataStream stream) {
return distanceTable.getNextValue(stream);
}
-} \ No newline at end of file
+}
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
index 883326ebe3..8d0febe31e 100755
--- 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
@@ -1,12 +1,12 @@
package org.eclipse.swt.internal.image;
-import org.eclipse.swt.*;
-
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
+import org.eclipse.swt.*;
+
class PngIdatChunk extends PngChunk {
PngIdatChunk(byte[] reference){
@@ -33,4 +33,4 @@ byte getDataByteAtOffset(int offset) {
return reference[DATA_OFFSET + offset];
}
-} \ No newline at end of file
+}
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
index 189cf8f7a3..899820a8d0 100755
--- 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
@@ -1,12 +1,12 @@
package org.eclipse.swt.internal.image;
-import org.eclipse.swt.*;
-
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
+import org.eclipse.swt.*;
+
class PngIendChunk extends PngChunk {
PngIendChunk(byte[] reference){
@@ -36,4 +36,4 @@ void validate(PngFileReadState readState, PngIhdrChunk headerChunk) {
if (getLength() > 0) SWT.error(SWT.ERROR_INVALID_IMAGE);
}
-} \ No newline at end of file
+}
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
index 00f3cec52e..15be5b80cf 100755
--- 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
@@ -1,13 +1,13 @@
package org.eclipse.swt.internal.image;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
+import org.eclipse.swt.*;
+import org.eclipse.swt.graphics.*;
+
class PngIhdrChunk extends PngChunk {
static final int EXPECTED_DATA_LENGTH = 13;
@@ -369,4 +369,4 @@ PaletteData getPaletteData() {
-} \ No newline at end of file
+}
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
index eab8cdfa7b..a828aa965d 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.internal.image;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class PngLzBlockReader {
@@ -65,12 +65,12 @@ void readNextBlockHeader() {
if (compressionType > 2) stream.error();
if (compressionType == UNCOMPRESSED) {
- int length = stream.getNextIdatByte()
- | (stream.getNextIdatByte() << 8);
- int testValue = stream.getNextIdatByte()
- | (stream.getNextIdatByte() << 8);
- if (length != ~testValue) stream.error();
- uncompressedBytesRemaining = length;
+ 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 {
@@ -166,4 +166,4 @@ private byte getNextCompressedByte() {
}
}
-} \ No newline at end of file
+}
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
index 8c41b83d22..677dbf83be 100755
--- 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
@@ -1,13 +1,13 @@
package org.eclipse.swt.internal.image;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
+import org.eclipse.swt.*;
+import org.eclipse.swt.graphics.*;
+
class PngPlteChunk extends PngChunk {
PngPlteChunk(byte[] reference){
@@ -84,4 +84,4 @@ void contributeToString(StringBuffer buffer) {
buffer.append(getPaletteSize());
}
-} \ No newline at end of file
+}
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
index a1910bade6..e65f28e4d9 100755
--- 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
@@ -1,12 +1,12 @@
package org.eclipse.swt.internal.image;
-import org.eclipse.swt.*;
-
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (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;
@@ -130,4 +130,4 @@ byte[] getAlphaValues(PngIhdrChunk header, PngPlteChunk paletteChunk) {
}
return alphas;
}
-} \ No newline at end of file
+}
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
index fc94da00d2..14c713d342 100755
--- 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
@@ -1,17 +1,14 @@
package org.eclipse.swt.internal.image;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
-/* Imports */
import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
import java.io.*;
-/* Class Definition */
final class WinBMPFileFormat extends FileFormat {
int compression;
int importantColors;
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
index 4ff4b0d3f9..4aac56ff9b 100755
--- 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
@@ -1,17 +1,14 @@
package org.eclipse.swt.internal.image;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
-/* Imports */
import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
import java.io.*;
-/* Class Definition */
final class WinICOFileFormat extends FileFormat {
/**
* Answer the size in bytes of the file representation of the given
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
index 64d1bf4dc0..051568f4d2 100755
--- 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
@@ -1,9 +1,8 @@
package org.eclipse.swt.layout;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
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
index b58e62fb39..3e4c762f2c 100755
--- 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
@@ -1,9 +1,8 @@
package org.eclipse.swt.layout;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
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
index 76d3220c92..e57e5c0c6e 100755
--- 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
@@ -1,9 +1,8 @@
package org.eclipse.swt.layout;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.*;
import org.eclipse.swt.widgets.*;
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
index a3a0f8f282..61c90135bc 100755
--- 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
@@ -1,9 +1,8 @@
package org.eclipse.swt.layout;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
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
index 1e43a2287c..73d36e9d2d 100755
--- 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
@@ -1,9 +1,8 @@
package org.eclipse.swt.layout;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
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
index 2f36647b51..4408b8f7ff 100755
--- 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
@@ -5,9 +5,9 @@
<title>Package-level Javadoc</title>
</head>
<body>
-Brief overview will be provided here.
+SWT layout classes
<h2>
Package Specification</h2>
-Detailed overview will be provided here.
+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/widgets/Dialog.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/widgets/Dialog.java
index c20fba446c..1b692b2383 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.*;
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
index 34c4c2ebea..5039985cae 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.*;
@@ -19,7 +19,7 @@ import org.eclipse.swt.graphics.*;
* </p>
*
* @see Listener
- * @see TypedEvent
+ * @see org.eclipse.swt.events.TypedEvent
*/
public class Event {
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
index 197c06245f..483e5a8d53 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import java.util.EventListener;
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
index a7c8744959..e6c7b68425 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.*;
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
index 120a78d145..e95adb3783 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.*;
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
index 0541c8a24f..eeb0de496b 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
/**
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
index a50c77e828..e5aa85a87e 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
/**
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
index 6338a4c0bb..ce34733dc5 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
/**
@@ -137,4 +137,4 @@ protected void syncExec (Runnable runnable) {
}
}
-} \ No newline at end of file
+}
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
index f4489cacab..14607192f7 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import java.util.EventListener;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/version.txt b/bundles/org.eclipse.swt/Eclipse SWT/common/version.txt
new file mode 100755
index 0000000000..1c3227e43c
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/common/version.txt
@@ -0,0 +1 @@
+version 0.125 \ No newline at end of file
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/library/build.csh b/bundles/org.eclipse.swt/Eclipse SWT/motif/library/build.csh
index f0cbe6f358..5a14d0d699 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/library/build.csh
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/library/build.csh
@@ -1,5 +1,8 @@
#!/bin/csh
-# (c) Copyright IBM Corp 1999, 2000
+
+# (c) Copyright IBM Corp., 2000, 2001
+# All Rights Reserved.
+
# This command script can be invoked with the "clean" argument.
# The major and minor version numbers and the build numbers are returned by the
@@ -7,7 +10,7 @@
# calls so java can query the swt shared library version number
setenv MAJOR_VER 0
-setenv MINOR_VER 105
+setenv MINOR_VER 125
setenv BUILD_NUM 0
# Some UNIX/Linux compilers don't like <CR>'s in files (DOS format).
@@ -43,16 +46,6 @@ switch ($OS )
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
- # KJC make -f make_solaris.mak make_cde
- endif
- breaksw
-
default:
echo "Unknown"
breaksw
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/library/gnome.c b/bundles/org.eclipse.swt/Eclipse SWT/motif/library/gnome.c
index 89ce255fad..183191bba9 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/library/gnome.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/library/gnome.c
@@ -1,3 +1,8 @@
+/*
+ * (c) Copyright IBM Corp., 2000, 2001
+ * All Rights Reserved.
+ */
+
/**
* SWT GNOME natives implementation.
*/
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/library/kde.cc b/bundles/org.eclipse.swt/Eclipse SWT/motif/library/kde.cc
index 374593b370..79cb99f03c 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/library/kde.cc
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/library/kde.cc
@@ -1,3 +1,8 @@
+/*
+ * (c) Copyright IBM Corp., 2000, 2001
+ * All Rights Reserved.
+ */
+
/**
* SWT KDE natives implementation.
*/
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/library/library.c b/bundles/org.eclipse.swt/Eclipse SWT/motif/library/library.c
index 9a2a6e8b8e..4bb5e249b7 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/library/library.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/library/library.c
@@ -1,3 +1,8 @@
+/*
+ * (c) Copyright IBM Corp., 2000, 2001
+ * All Rights Reserved.
+ */
+
/**
* library.c
*
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/library/make_linux.mak b/bundles/org.eclipse.swt/Eclipse SWT/motif/library/make_linux.mak
index 8a0c7a8c99..def0e62635 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/library/make_linux.mak
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/library/make_linux.mak
@@ -1,5 +1,8 @@
# Makefile for creating SWT libraries on Linux
-#
+
+# (c) Copyright IBM Corp., 2000, 2001
+# All Rights Reserved.
+
# The following environment variables are assumed to be defined:
#
# MAJOR_VER - the major version number
@@ -23,7 +26,7 @@ QT_HOME = /usr/lib/qt-2.2.0
SWT_PREFIX = swt
SWT_DLL = lib$(SWT_PREFIX)$(DLL_VERSION).so
SWT_OBJ = callback.o globals.o library.o structs.o swt.o
-SWT_LIB = $(MOTIF_HOME)/lib/libXm.a -L/usr/lib -L/usr/X11R6/lib \
+SWT_LIB = -L$(MOTIF_HOME)/lib -lXm -L/usr/lib -L/usr/X11R6/lib \
-x -shared -lX11 -lm -lXext -lXt -lXp -lXpm -ldl
GNOME_PREFIX = swt-gnome
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/library/structs.c b/bundles/org.eclipse.swt/Eclipse SWT/motif/library/structs.c
index 02445f103d..1891c13891 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/library/structs.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/library/structs.c
@@ -1,3 +1,8 @@
+/*
+ * (c) Copyright IBM Corp., 2000, 2001
+ * All Rights Reserved.
+ */
+
/**
* JNI SWT object field getters and setters declarations for Motif structs.
*/
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/library/structs.h b/bundles/org.eclipse.swt/Eclipse SWT/motif/library/structs.h
index 27368d54e0..0d8abaf35f 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/library/structs.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/library/structs.h
@@ -1,3 +1,8 @@
+/*
+ * (c) Copyright IBM Corp., 2000, 2001
+ * All Rights Reserved.
+ */
+
/**
* JNI SWT object field getters and setters declarations for Motif structs
*/
@@ -12,6 +17,7 @@
#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>
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/library/swt.c b/bundles/org.eclipse.swt/Eclipse SWT/motif/library/swt.c
index 0e58c2f576..99d97120cf 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/library/swt.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/library/swt.c
@@ -1,3 +1,8 @@
+/*
+ * (c) Copyright IBM Corp., 2000, 2001
+ * All Rights Reserved.
+ */
+
/**
* SWT OS natives implementation.
*/
@@ -1608,6 +1613,34 @@ JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_OS_XFreeCursor
/*
* 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
*/
@@ -3850,6 +3883,51 @@ JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XmFontListEntryGet
/*
* 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
*/
@@ -7897,3 +7975,117 @@ JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_OS_XpQueryVersion
/*
* ======== 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 *)buf, 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 *)buf, nbyte);
+ if (buf)
+ (*env)->ReleaseByteArrayElements(env, buf, buf1, 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);
+}
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
index 24b7b94242..c8edd74f01 100755
--- 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
@@ -1,17 +1,30 @@
package org.eclipse.swt.graphics;
-import org.eclipse.swt.internal.motif.*;
-import org.eclipse.swt.*;
-
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (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.
+ /**
+ * the handle to the OS color resource
+ * (Warning: This field is platform dependent)
*/
public XColor handle;
@@ -22,16 +35,66 @@ public final class Color {
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;
- int xDisplay = device.xDisplay;
+ 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 */
@@ -44,27 +107,87 @@ public void dispose() {
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) {
@@ -176,6 +299,16 @@ void init(Device device, int red, int green, int blue) {
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;
}
@@ -186,12 +319,14 @@ public static Color motif_new(Device device, XColor xColor) {
color.device = device;
return color;
}
-/**
- * Return a string representation of the Color.
- *
- * @return a string representation of the 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
index 88490e9fc1..5792deab48 100755
--- 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
@@ -1,17 +1,38 @@
package org.eclipse.swt.graphics;
-import org.eclipse.swt.internal.motif.*;
-import org.eclipse.swt.*;
-
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (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.
+ /**
+ * the handle to the OS cursor resource
+ * (Warning: This field is platform dependent)
*/
public int handle;
@@ -22,6 +43,22 @@ public final class Cursor {
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);
@@ -55,6 +92,36 @@ public Cursor (Device device, int style) {
}
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);
@@ -62,7 +129,7 @@ public Cursor (Device device, ImageData source, ImageData mask, int hotspotX, in
if (source == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
if (mask == null) {
if (source.getTransparencyType() != SWT.TRANSPARENCY_MASK) {
- SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ SWT.error(SWT.ERROR_INVALID_ARGUMENT);
}
mask = source.getTransparencyMask();
}
@@ -127,20 +194,57 @@ public Cursor (Device device, ImageData source, ImageData mask, int hotspotX, in
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) OS.XFreeCursor(device.xDisplay, handle);
- device = null;
+ 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;
}
@@ -151,4 +255,14 @@ public static Cursor motif_new(Device device, int handle) {
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
index 39737ff830..07ff9ce115 100755
--- 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
@@ -1,5 +1,10 @@
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.*;
@@ -30,7 +35,12 @@ public abstract class Device implements Drawable {
/* 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;
+ 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;
@@ -46,10 +56,50 @@ public abstract class Device implements Drawable {
XDefaultPrintServer = ":1";
}
protected static int xPrinter;
+
+ /*
+ * 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) {
- create (data);
- init ();
if (data != null) {
display_name = data.display_name;
application_name = data.application_name;
@@ -57,27 +107,19 @@ public Device(DeviceData data) {
tracking = data.tracking;
debug = data.debug;
}
+ create (data);
+ init ();
if (tracking) {
errors = new Error [128];
objects = new Object [128];
- }
-}
-
-/**
- * Temporary code.
- */
-static Device getDevice () {
- Device device = null;
- try {
- Class clazz = Class.forName ("org.eclipse.swt.widgets.Display");
- java.lang.reflect.Method method = clazz.getMethod("getCurrent", new Class[0]);
- device = (Device) method.invoke(clazz, new Object[0]);
- if (device == null) {
- method = clazz.getMethod("getDefault", new Class[0]);
- device = (Device)method.invoke(clazz, new Object[0]);
- }
- } catch (Throwable e) {};
- return device;
+ }
+
+ /* 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 () {
@@ -90,6 +132,16 @@ 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 ();
@@ -112,6 +164,15 @@ void dispose_Object (Object object) {
}
}
+/**
+ * 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);
@@ -120,16 +181,53 @@ public Rectangle getBounds () {
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 ();
@@ -156,6 +254,17 @@ public DeviceData getDeviceData () {
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);
@@ -171,6 +280,19 @@ public Point getDPI () {
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;
@@ -212,6 +334,24 @@ public FontData [] getFontList (String faceName, boolean scalable) {
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;
@@ -237,25 +377,42 @@ public Color getSystemColor (int id) {
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 ();
- int shellHandle, widgetHandle;
- int widgetClass = OS.TopLevelShellWidgetClass ();
- shellHandle = OS.XtAppCreateShell (null, null, widgetClass, xDisplay, null, 0);
- widgetHandle = OS.XmCreateLabel (shellHandle, null, null, 0);
- int [] argList = {OS.XmNfontList, 0};
- OS.XtGetValues (widgetHandle, argList, argList.length / 2);
- /**
- * 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.
- */
- int labelFont = OS.XmFontListCopy (argList [1]);
- OS.XtDestroyWidget (shellHandle);
- return Font.motif_new (this, labelFont);
+ 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;
@@ -321,10 +478,50 @@ protected void init () {
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 xDisplay == 0;
}
@@ -373,18 +570,53 @@ protected void release () {
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;
-
- /* Release the warning and error callbacks */
- xtWarningCallback.dispose (); xtWarningCallback = null;
- xtWarningProc = 0;
- xErrorCallback.dispose (); xErrorCallback = null;
- xErrorProc = 0;
- xtErrorCallback.dispose (); xtErrorCallback = null;
- xtErrorProc = 0;
- xIOErrorCallback.dispose (); xIOErrorCallback = null;
- xIOErrorProc = 0;
+
+ /* 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;
@@ -431,4 +663,4 @@ int xtWarningProc (int message) {
return 0;
}
-} \ No newline at end of file
+}
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
index 565fb06229..d92b594936 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.graphics;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class DeviceData {
@@ -21,4 +21,4 @@ public class DeviceData {
public boolean tracking;
public Error [] errors;
public Object [] objects;
-} \ No newline at end of file
+}
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
index b979ea2d42..3345d70dde 100755
--- 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
@@ -1,18 +1,31 @@
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.*;
-/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
- */
-
+/**
+ * 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.
+ /**
+ * the handle to the OS font resource
+ * (Warning: This field is platform dependent)
*/
public int handle;
@@ -23,24 +36,113 @@ public final class Font {
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) OS.XmFontListFree (handle);
+ 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.
@@ -57,7 +159,7 @@ public FontData[] getFontData() {
/* Go through each entry in the font list */
while ((fontListEntry = OS.XmFontListNextEntry(context)) != 0) {
int fontPtr = OS.XmFontListEntryGetFont(fontListEntry, buffer);
- if (buffer[0] == 0) {
+ if (buffer[0] == OS.XmFONT_IS_FONT) {
/* FontList contains a single font */
OS.memmove(fontStruct,fontPtr,20 * 4);
int propPtr = fontStruct.properties;
@@ -135,22 +237,92 @@ public FontData[] getFontData() {
}
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) {
+ byte[] buffer = Converter.wcsToMbcs(null, fd.getXlfd(), true);
+ return OS.XLoadQueryFont(xDisplay, buffer);
+}
+int matchFont(int xDisplay, FontData fd) {
+ int fontStruct = loadFont(xDisplay, fd);
+ if (fontStruct != 0) return fontStruct;
+ if (fd.slant != null) {
+ fd.slant = null;
+ fontStruct = loadFont(xDisplay, fd);
+ if (fontStruct != 0) return fontStruct;
+ }
+ if (fd.weight != null) {
+ fd.weight = null;
+ fontStruct = loadFont(xDisplay, fd);
+ if (fontStruct != 0) return fontStruct;
+ }
+ if (fd.points != 0) {
+ fd.points = 0;
+ fontStruct = loadFont(xDisplay, fd);
+ if (fontStruct != 0) return fontStruct;
+ }
+ 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;
- byte[] buffer = Converter.wcsToMbcs(null, fd.getXlfd(), true);
- boolean warnings = device.getWarnings();
- device.setWarnings(false);
- int fontListEntry = OS.XmFontListEntryLoad(device.xDisplay, buffer, 0, OS.XmFONTLIST_DEFAULT_TAG);
- device.setWarnings(warnings);
+ int xDisplay = device.xDisplay;
+ 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);
+
+ /* Failed to load any font. Use the system font. */
+ if (fontStruct == 0) {
+ handle = device.systemFont;
+ if (handle != 0) return;
+ }
+ }
+ if (fontStruct == 0) SWT.error(SWT.ERROR_NO_HANDLES);
+ int fontListEntry = OS.XmFontListEntryCreate(OS.XmFONTLIST_DEFAULT_TAG, OS.XmFONT_IS_FONT, fontStruct);
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;
}
@@ -161,4 +333,14 @@ public static Font motif_new(Device device, int handle) {
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
index 31494f022e..ac4958afe4 100755
--- 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
@@ -1,12 +1,37 @@
package org.eclipse.swt.graphics;
-import org.eclipse.swt.*;
-
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (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
@@ -78,8 +103,30 @@ public final class FontData {
* Warning: This field is platform dependent.
*/
public String characterSetName;
+/**
+ * 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;
@@ -149,6 +196,19 @@ public FontData(String string) {
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_INVALID_ARGUMENT - if the height is negative</li>
+ * </ul>
+ */
public FontData (String name, int height, int style) {
if (height < 0) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
if (name != null) {
@@ -170,13 +230,39 @@ public FontData (String name, int height, int style) {
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) {
@@ -186,6 +272,15 @@ public String getName() {
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"))
@@ -216,6 +311,16 @@ String getXlfd() {
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();
}
@@ -224,10 +329,45 @@ public static FontData motif_new(String xlfd) {
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
+ *
+ * @see #getName
+ */
public void setName(String name) {
if (name == null) {
foundry = fontFamily = null;
@@ -241,6 +381,15 @@ public void setName(String name) {
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";
@@ -314,6 +463,15 @@ void setXlfd(String xlfd) {
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
index 43d69ae41c..97dd248150 100755
--- 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
@@ -1,14 +1,33 @@
package org.eclipse.swt.graphics;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (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;
@@ -17,21 +36,71 @@ public boolean equals (Object object) {
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;
}
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
index b5dc6a73d8..36f1186e8a 100755
--- 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
@@ -1,18 +1,32 @@
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.*;
-
-/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
- */
+/**
+ * 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 GC resource.
- * Warning: This field is platform dependent.
+ /**
+ * the handle to the OS device context
+ * (Warning: This field is platform dependent)
*/
public int handle;
@@ -23,6 +37,23 @@ public final class GC {
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();
@@ -30,7 +61,23 @@ public GC (Drawable drawable) {
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;
@@ -56,9 +103,25 @@ public void copyArea(int x, int y, int width, int height, int destX, int destY)
}
}
}
+/**
+ * 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) SWT.error(SWT.ERROR_INVALID_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);
@@ -67,8 +130,14 @@ public void copyArea(Image image, int x, int y) {
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 (handle == 0) return;
+ if (data.device.isDisposed()) return;
/* Free resources */
int clipRgn = data.clipRgn;
@@ -89,7 +158,40 @@ public void dispose () {
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;
@@ -103,7 +205,25 @@ public void drawArc(int x, int y, int width, int height, int startAngle, int end
}
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.
@@ -133,16 +253,69 @@ public void drawFocus (int x, int y, int width, int height) {
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 given coordinates are outside the bounds of the image</li>
+ * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</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 given coordinates are outside the bounds of their respective images</li>
+ * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li>
+ * </ul>
+ * @exception SWTError <uo>
+ * <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) {
@@ -430,10 +603,46 @@ static int scalePixmap(int display, int pixmap, int srcX, int srcY, int srcWidth
}
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;
@@ -444,7 +653,25 @@ public void drawOval(int x, int y, int width, int 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
@@ -485,7 +712,25 @@ public void drawPolygon(int[] pointArray) {
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++) {
@@ -493,7 +738,23 @@ public void drawPolyline(int[] pointArray) {
}
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;
@@ -504,11 +765,47 @@ public void drawRectangle (int x, int y, int width, int 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.
@@ -547,20 +844,49 @@ public void drawRoundRectangle (int x, int y, int width, int height, int arcWidt
OS.XDrawLine(xDisplay,xDrawable,handle,nx + naw2, ny + nh, nx + nw - naw2, ny + nh);
OS.XDrawLine(xDisplay,xDrawable,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 this graphics context's
- * current font and foreground color.
- * No tab expansion or CR processing will be performed.
- *
- * @param string the string to be drawn.
- * @param x the <i>x</i> coordinate.
- * @param y the <i>y</i> coordinate.
- * @param isTransparent if true, the background will be transparent.
+/**
+ * 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 (null, string, true);
int xmString = OS.XmStringCreate (buffer, OS.XmFONTLIST_DEFAULT_TAG);
@@ -624,20 +950,49 @@ void createRenderTable() {
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, false);
}
-/**
- * Draws the text given by the specified string, using this
- * graphics context's current font and foreground color.
- * The string will be formatted with tab expansion and CR processing.
- *
- * @param string the string to be drawn.
- * @param x the <i>x</i> coordinate.
- * @param y the <i>y</i> coordinate.
- * @param isTransparent if true, the background will be transparent.
+/**
+ * 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);
if (data.renderTable == 0) createRenderTable();
int renderTable = data.renderTable;
@@ -651,13 +1006,58 @@ public void drawText (String string, int x, int y, boolean isTransparent) {
// OS.XmStringDrawUnderline (display, drawable, renderTable, xmString, handle, x, y, 0x7FFFFFFF, OS.XmALIGNMENT_BEGINNING, 0, null, 0);
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;
- GC gc = (GC)object;
- return data.device == gc.data.device && handle == gc.handle;
+ 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;
@@ -676,7 +1076,24 @@ public void fillArc(int x, int y, int width, int height, int startAngle, int end
OS.XFillArc(xDisplay,data.drawable,handle,x,y,width,height,startAngle * 64 ,endAngle * 64);
OS.XSetForeground (xDisplay, handle, values.foreground);
}
+/**
+ * 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;
@@ -692,7 +1109,27 @@ public void fillOval (int x, int y, int width, int height) {
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++) {
@@ -705,7 +1142,23 @@ public void fillPolygon(int[] pointArray) {
OS.XFillPolygon(xDisplay, data.drawable, handle,xPoints, xPoints.length / 2, OS.Convex, 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;
@@ -721,16 +1174,44 @@ public void fillRectangle (int x, int y, int width, int height) {
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);
- 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, rect.x, rect.y, rect.width, rect.height);
- OS.XSetForeground (xDisplay, handle, values.foreground);
+ 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;
@@ -771,7 +1252,23 @@ public void fillRoundRectangle (int x, int y, int width, int height, int arcWidt
OS.XFillRectangle(xDisplay,xDrawable,handle,nx + nw - (naw / 2), ny + nah2, naw2, nh -nah);
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(null, new char[] { ch }, false);
int val = charBuffer[0] & 0xFF;
@@ -858,7 +1355,17 @@ public int getAdvanceWidth(char ch) {
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();
if (OS.XGetGCValues(xDisplay, handle, OS.GCBackground, values) == 0) {
@@ -872,7 +1379,24 @@ public Color getBackground() {
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(null, new char[] { ch }, false);
int val = charBuffer[0] & 0xFF;
@@ -959,7 +1483,20 @@ public int getCharWidth(char ch) {
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];
@@ -971,7 +1508,21 @@ public Rectangle getClipping() {
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;
@@ -989,7 +1540,18 @@ public void getClipping(Region region) {
OS.XSubtractRegion (hRegion, hRegion, hRegion);
OS.XUnionRegion (clipRgn, hRegion, 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 () {
+ if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
return Font.motif_new(data.device, data.fontList);
}
int getFontHeight () {
@@ -1034,7 +1596,19 @@ int getFontHeight () {
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 */
@@ -1185,7 +1759,17 @@ public FontMetrics getFontMetrics() {
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();
if (OS.XGetGCValues(xDisplay, handle, OS.GCForeground, values) == 0) {
@@ -1199,19 +1783,70 @@ public Color getForeground() {
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;
}
@@ -1235,9 +1870,34 @@ void init(Drawable drawable, GCData data, int xGC) {
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;
}
@@ -1247,12 +1907,43 @@ public static GC motif_new(Drawable drawable, GCData 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 ();
@@ -1265,14 +1956,38 @@ public void setClipping (int x, int y, int width, int 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);
@@ -1290,19 +2005,66 @@ public void setClipping (Region region) {
OS.XSetRegion (data.display, handle, region.handle);
}
}
-public void setFont (Font font) {
- if (font == null) font = data.device.getSystemFont ();
- if (font.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- data.fontList = font.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:
@@ -1328,20 +2090,68 @@ public void setLineStyle(int 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);
}
}
-public void setXORMode(boolean val) {
- if (val)
+/**
+ * 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(null, string, true);
@@ -1352,7 +2162,27 @@ public Point stringExtent(String string) {
OS.XmStringFree(xmString);
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);
if (string.length () == 0) return new Point(0, getFontHeight());
byte [] textBuffer = Converter.wcsToMbcs (null, string, true);
@@ -1364,4 +2194,14 @@ public Point textExtent(String string) {
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
index 410257e4af..3e0af475c8 100755
--- 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
@@ -1,7 +1,24 @@
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;
@@ -14,4 +31,4 @@ public final class GCData {
public int clipRgn;
public int lineStyle = SWT.LINE_SOLID;
public int renderTable;
-} \ No newline at end of file
+}
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
index 6d43261abd..70d84c99d2 100755
--- 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
@@ -1,18 +1,65 @@
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.*;
-
-/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
- */
+/**
+ * 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);</code>
+ * </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.
- * Values: SWT.BITMAP, SWT.ICON
+ /**
+ * specifies whether the receiver is a bitmap or an icon
+ * (one of <code>SWT.BITMAP</code>, <code>SWT.ICON</code>)
*/
public int type;
@@ -65,14 +112,65 @@ public final class Image implements Drawable {
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;
@@ -338,13 +436,68 @@ public Image(Device device, Image srcImage, int flag) {
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>
+ * </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);
@@ -357,9 +510,52 @@ public Image(Device device, ImageData source, ImageData mask) {
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));
}
@@ -380,8 +576,14 @@ void createMask() {
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);
@@ -397,6 +599,16 @@ void destroyMask() {
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;
@@ -405,7 +617,26 @@ public boolean equals (Object object) {
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;
@@ -414,13 +645,40 @@ public Color getBackground() {
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 (pixmap == 0) return new Rectangle(0, 0, 0, 0);
+ 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;
@@ -597,6 +855,16 @@ static boolean getOffsetForMask(int bitspp, int mask, int byteOrder, int[] poff)
}
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;
}
@@ -670,6 +938,21 @@ void init(Device device, ImageData image) {
}
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 (type != SWT.BITMAP || memGC != null) {
SWT.error(SWT.ERROR_INVALID_ARGUMENT);
@@ -681,16 +964,44 @@ public int internal_new_GC (GCData data) {
data.device = device;
data.display = xDisplay;
data.drawable = pixmap;
- data.fontList = device.getSystemFont ().handle;
+ 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 = device.xDisplay;
+ 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;
}
@@ -844,7 +1155,35 @@ static int putImage(ImageData image, int srcX, int srcY, int srcWidth, int srcHe
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>
+ * This method has no effect if the receiver does not have a transparent
+ * pixel value.
+ *
+ * @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;
@@ -869,4 +1208,14 @@ public void setBackground(Color color) {
/* 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
index 9558cca0cc..b314d0f539 100755
--- 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
@@ -1,26 +1,53 @@
package org.eclipse.swt.graphics;
-import org.eclipse.swt.internal.motif.*;
-import org.eclipse.swt.*;
-
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (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 handle to the OS region resource.
- * Warning: This field is platform dependent.
+ /**
+ * 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>
+ * </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);
XRectangle xRect = new XRectangle();
xRect.x = (short)rect.x;
@@ -29,21 +56,80 @@ public void add (Rectangle rect) {
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>
+ * </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);
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;
@@ -52,28 +138,119 @@ public boolean equals (Object object) {
if (xRegion == 0) return false;
return OS.XEqualRegion(handle, xRegion);
}
+/**
+ * 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
index 682f69081f..cf248bd654 100755
--- 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
@@ -1,15 +1,30 @@
package org.eclipse.swt.internal;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (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 |
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/GNOME.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/GNOME.java
index fe586144f2..aff863b710 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/GNOME.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/GNOME.java
@@ -1,8 +1,8 @@
package org.eclipse.swt.internal.motif;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class GNOME extends OS {
@@ -15,4 +15,4 @@ 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);
-} \ No newline at end of file
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/KDE.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/KDE.java
index af9a2fb618..949c48c736 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/KDE.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/KDE.java
@@ -1,8 +1,8 @@
package org.eclipse.swt.internal.motif;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class KDE extends OS {
@@ -51,4 +51,4 @@ public static final native void KServiceListIterator_increment(int receiver);
public static final native int KServiceListIterator_new(int listBeginning);
public static final native int KServiceListIterator_equals(int receiver, int object);
-} \ No newline at end of file
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/OS.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/OS.java
index 0aab013563..c311603786 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/OS.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/OS.java
@@ -3,8 +3,8 @@ package org.eclipse.swt.internal.motif;
import org.eclipse.swt.internal.*;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class OS {
@@ -155,7 +155,7 @@ public class OS {
// 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 KeyRelease = 3;
public static final int KeyReleaseMask = 1 << 1;
// public static final int LeaveNotify = 8;
public static final int LeaveWindowMask = 1 << 5;
@@ -379,7 +379,8 @@ public class OS {
public static final int XK_Shift_L = 0xFFE1;
public static final int XK_Shift_R = 0xFFE2;
public static final int XK_Tab = 0xFF09;
- public static final int XK_Up = 0xFF52;
+ 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;
@@ -525,6 +526,7 @@ public class OS {
// 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;
@@ -534,6 +536,7 @@ public class OS {
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;
@@ -557,7 +560,9 @@ public class OS {
public static final int XmNONE = 0x0;
// public static final int XmNUMERIC = 0x3;
- /* char */
+ /* byte */
+ public static final int XmNancestorSensitive = malloc ("ancestorSensitive");
+ public static final int XmNanimationStyle = malloc ("animationStyle");
public static final int XmNalignment = malloc ("alignment");
public static final int XmNarrowDirection = malloc ("arrowDirection");
public static final int XmNblendModel = malloc ("blendModel");
@@ -570,7 +575,8 @@ public class OS {
public static final int XmNdragInitiatorProtocolStyle = malloc ("dragInitiatorProtocolStyle");
public static final int XmNdragReceiverProtocolStyle = malloc ("dragReceiverProtocolStyle");
public static final int XmNdragOperations = malloc ("dragOperations");
- public static final int XmNeditable = malloc ("editable");
+ public static final int XmNeditable = malloc ("editable");
+ public static final int XmNenableThinThickness = malloc ("enableThinThickness");
public static final int XmNiconic = malloc ("iconic");
public static final int XmNlabelType = malloc ("labelType");
public static final int XmNleftAttachment = malloc ("leftAttachment");
@@ -579,6 +585,7 @@ public class OS {
public static final int XmNindicatorType = malloc ("indicatorType");
public static final int XmNnoResize = malloc ("noResize");
public static final int XmNorientation = malloc ("orientation");
+ public static final int XmNoverrideRedirect = malloc ("overrideRedirect");
public static final int XmNprocessingDirection = malloc ("processingDirection");
public static final int XmNrecomputeSize = malloc ("recomputeSize");
public static final int XmNpushButtonEnabled = malloc ("pushButtonEnabled");
@@ -727,7 +734,7 @@ public class OS {
public static final int XmNdropTransfers = malloc ("dropTransfers");
public static final int XmNshowArrows = malloc ("showArrows");
-/* Unknown */
+ /* Unknown */
public static final int XmNdropSiteActivity = malloc("dropSiteActivity");
public static final int XmNdropSiteOperations = malloc("dropSiteOperations");
public static final int XmNdropSiteType = malloc("dropSiteType");
@@ -886,6 +893,8 @@ public static final native int XFree (int address);
public static final native int XFreeColors (int display, int colormap, int [] pixels, int npixels, int planes);
public static final native void XFreeCursor (int display, int pixmap);
public static final native void XFreeFontNames(int list);
+public static final native void XFreeFont(int display, int font_struct);
+public static final native void XFreeFontSet(int display, int font_set);
public static final native void XFreeGC (int display, int gc);
public static final native void XFreePixmap (int display, int pixmap);
public static final native int XGetGCValues (int display, int gc, int valuemask, XGCValues values);
@@ -1183,6 +1192,7 @@ public static final native void memmove (int dest, byte [] 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);
@@ -1247,4 +1257,19 @@ public static final 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 XtAppAddInput (int app_context, int source, int condition, int proc, int client_data);
+public static final 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 native int XLoadQueryFont (int display, byte[] name);
+public static final native int XmFontListEntryCreate (byte[] tag, int type, int font);
+
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/Visual.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/Visual.java
index 7b23c27be8..def3fb5860 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/Visual.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/Visual.java
@@ -1,8 +1,8 @@
package org.eclipse.swt.internal.motif;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class Visual {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XAnyEvent.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XAnyEvent.java
index dd733286ee..4e2936a376 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XAnyEvent.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XAnyEvent.java
@@ -1,8 +1,8 @@
package org.eclipse.swt.internal.motif;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class XAnyEvent extends XEvent {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XButtonEvent.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XButtonEvent.java
index b8b8cb3a6c..2f8234ce5d 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XButtonEvent.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XButtonEvent.java
@@ -1,8 +1,8 @@
package org.eclipse.swt.internal.motif;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class XButtonEvent extends XInputEvent {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XCharStruct.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XCharStruct.java
index bdec29c6db..a9c92b492b 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XCharStruct.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XCharStruct.java
@@ -1,8 +1,8 @@
package org.eclipse.swt.internal.motif;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class XCharStruct {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XColor.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XColor.java
index 5f38a015be..bd9c4a306d 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XColor.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XColor.java
@@ -1,8 +1,8 @@
package org.eclipse.swt.internal.motif;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class XColor {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XConfigureEvent.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XConfigureEvent.java
index 3842b9584e..c8d58b705f 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XConfigureEvent.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XConfigureEvent.java
@@ -1,8 +1,8 @@
package org.eclipse.swt.internal.motif;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class XConfigureEvent extends XEvent {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XCrossingEvent.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XCrossingEvent.java
index 14605f9f88..ad59913ffc 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XCrossingEvent.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XCrossingEvent.java
@@ -1,8 +1,8 @@
package org.eclipse.swt.internal.motif;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class XCrossingEvent extends XWindowEvent {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XEvent.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XEvent.java
index 11c539fdff..1b20cb2be8 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XEvent.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XEvent.java
@@ -1,8 +1,8 @@
package org.eclipse.swt.internal.motif;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public abstract class XEvent {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XExposeEvent.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XExposeEvent.java
index d6a470345f..25fc25485d 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XExposeEvent.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XExposeEvent.java
@@ -1,8 +1,8 @@
package org.eclipse.swt.internal.motif;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class XExposeEvent extends XEvent {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XFocusChangeEvent.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XFocusChangeEvent.java
index b0073ad986..c46dcfafd9 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XFocusChangeEvent.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XFocusChangeEvent.java
@@ -1,8 +1,8 @@
package org.eclipse.swt.internal.motif;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class XFocusChangeEvent extends XEvent {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XFontStruct.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XFontStruct.java
index 5062f111ab..e03dad6fec 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XFontStruct.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XFontStruct.java
@@ -1,8 +1,8 @@
package org.eclipse.swt.internal.motif;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class XFontStruct {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XGCValues.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XGCValues.java
index eebdef85d6..df6eb2db1e 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XGCValues.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XGCValues.java
@@ -1,8 +1,8 @@
package org.eclipse.swt.internal.motif;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class XGCValues {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XImage.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XImage.java
index 691df05be9..56f8e4f268 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XImage.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XImage.java
@@ -1,8 +1,8 @@
package org.eclipse.swt.internal.motif;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class XImage {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XInputEvent.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XInputEvent.java
index fde28843f7..553d7a6bd7 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XInputEvent.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XInputEvent.java
@@ -1,8 +1,8 @@
package org.eclipse.swt.internal.motif;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public abstract class XInputEvent extends XWindowEvent {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XKeyEvent.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XKeyEvent.java
index 1541cfe711..3323552e5f 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XKeyEvent.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XKeyEvent.java
@@ -1,8 +1,8 @@
package org.eclipse.swt.internal.motif;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class XKeyEvent extends XInputEvent {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XMotionEvent.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XMotionEvent.java
index 82428b47d4..d25e8a2a26 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XMotionEvent.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XMotionEvent.java
@@ -1,8 +1,8 @@
package org.eclipse.swt.internal.motif;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class XMotionEvent extends XInputEvent {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XRectangle.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XRectangle.java
index b8feffa676..5badc8584c 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XRectangle.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XRectangle.java
@@ -1,8 +1,8 @@
package org.eclipse.swt.internal.motif;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class XRectangle {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XSetWindowAttributes.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XSetWindowAttributes.java
index 5f4d79350e..faae3320f6 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XSetWindowAttributes.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XSetWindowAttributes.java
@@ -1,8 +1,8 @@
package org.eclipse.swt.internal.motif;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class XSetWindowAttributes {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XWindowAttributes.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XWindowAttributes.java
index 11d1443999..26fae4cbc5 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XWindowAttributes.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XWindowAttributes.java
@@ -1,8 +1,8 @@
package org.eclipse.swt.internal.motif;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class XWindowAttributes {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XWindowChanges.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XWindowChanges.java
index 991383513c..329f8a8c53 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XWindowChanges.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XWindowChanges.java
@@ -1,8 +1,8 @@
package org.eclipse.swt.internal.motif;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class XWindowChanges {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XWindowEvent.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XWindowEvent.java
index 5d229c0f57..2084e1ab85 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XWindowEvent.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XWindowEvent.java
@@ -1,8 +1,8 @@
package org.eclipse.swt.internal.motif;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public abstract class XWindowEvent extends XEvent {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XmAnyCallbackStruct.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XmAnyCallbackStruct.java
index 389e0d1fb1..351cb19066 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XmAnyCallbackStruct.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XmAnyCallbackStruct.java
@@ -1,8 +1,8 @@
package org.eclipse.swt.internal.motif;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class XmAnyCallbackStruct {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XmDragProcCallback.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XmDragProcCallback.java
index 6afd4717cd..f4a0c6f254 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XmDragProcCallback.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XmDragProcCallback.java
@@ -1,8 +1,8 @@
package org.eclipse.swt.internal.motif;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class XmDragProcCallback {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XmDropFinishCallback.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XmDropFinishCallback.java
index 07586efac3..d5a9660286 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XmDropFinishCallback.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XmDropFinishCallback.java
@@ -1,8 +1,8 @@
package org.eclipse.swt.internal.motif;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class XmDropFinishCallback {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XmDropProcCallback.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XmDropProcCallback.java
index f8e95ff1d0..5b7a9d1b51 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XmDropProcCallback.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XmDropProcCallback.java
@@ -1,8 +1,8 @@
package org.eclipse.swt.internal.motif;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class XmDropProcCallback {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XmTextBlockRec.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XmTextBlockRec.java
index c508f8f420..4094f36e81 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XmTextBlockRec.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XmTextBlockRec.java
@@ -1,8 +1,8 @@
package org.eclipse.swt.internal.motif;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class XmTextBlockRec {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XmTextVerifyCallbackStruct.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XmTextVerifyCallbackStruct.java
index 8d5203cfa2..4d14db1da1 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XmTextVerifyCallbackStruct.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XmTextVerifyCallbackStruct.java
@@ -1,8 +1,8 @@
package org.eclipse.swt.internal.motif;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class XmTextVerifyCallbackStruct extends XmAnyCallbackStruct {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XtWidgetGeometry.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XtWidgetGeometry.java
index 661378fadc..785d28bb72 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XtWidgetGeometry.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/internal/motif/XtWidgetGeometry.java
@@ -1,8 +1,8 @@
package org.eclipse.swt.internal.motif;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class XtWidgetGeometry {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/AbstractTreeItem.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/AbstractTreeItem.java
index b23dff6c03..41f7d95a58 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/AbstractTreeItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/AbstractTreeItem.java
@@ -1,14 +1,14 @@
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.*;
-/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
- */
-
/**
* This class stores and manages child items of a tree item.
* It provides protocol to query the index of an item relative
@@ -109,25 +109,20 @@ void deselectAll() {
treeItem.deselectAll();
}
}
-/**
- * Destroy all children of the receiver
- */
-void disposeItem() {
+public void dispose() {
+ if (!isValidWidget ()) return;
Vector children = getChildren();
AbstractTreeItem child;
while (children.size() > 0) { // TreeItem objects are removed from vector during dispose
child = (AbstractTreeItem) children.firstElement();
child.dispose();
}
- doDispose();
- super.disposeItem();
+ super.dispose();
}
-/**
- * Subclasses should free resources here
- */
void doDispose() {
setChildren(null);
visibleItemCount = 0;
+ super.doDispose();
}
/**
* Answer the Vector containing the child items of the receiver.
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
index 93b8ec8dbc..ebacd6aa45 100755
--- 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
@@ -1,31 +1,32 @@
package org.eclipse.swt.widgets;
/*
-* Licensed Materials - Property of IBM,
-* SWT - The Simple Widget Toolkit,
-* (c) Copyright IBM Corp 1998, 1999.
-*/
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
-/* Imports */
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.*;
-/**
-* The button class represents a selectable user interface object
-* that issues notificiation when pressed and released.
-*
-* <p>
-* <b>Styles</b><br>
-* <dd>ARROW, CHECK, PUSH, RADIO, TOGGLE<br>
-* <br>
-* <b>Events</b><br>
-* <dd>Selection<br>
-*/
+/**
+ * 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>
+ */
-/* Class Definition */
public /*final*/ class Button extends Control {
Image image, bitmap, disabled;
static final byte [] ARM_AND_ACTIVATE;
@@ -40,25 +41,61 @@ public /*final*/ class Button extends Control {
}
ARM_AND_ACTIVATE = buffer;
}
-/**
-* Creates a new instance of the 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 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 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
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -131,6 +168,7 @@ public Point computeSize (int wHint, int hHint, boolean changed) {
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) {
@@ -143,8 +181,9 @@ void createHandle (int index) {
OS.XmNtraversalOn, 0,
OS.XmNarrowDirection, alignment,
OS.XmNborderWidth, borderWidth,
+ OS.XmNancestorSensitive, 1,
};
- handle = OS.XmCreateArrowButton (parent.handle, null, argList, argList.length / 2);
+ 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};
@@ -166,14 +205,17 @@ void createHandle (int index) {
* 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 : 2,
+ OS.XmNshadowThickness, (style & SWT.FLAT) != 0 ? 1 : thickness,
OS.XmNalignment, alignment,
OS.XmNborderWidth, borderWidth,
};
- handle = OS.XmCreateToggleButton (parent.handle, null, argList, argList.length / 2);
+ handle = OS.XmCreateToggleButton (parentHandle, null, argList, argList.length / 2);
if (handle == 0) error (SWT.ERROR_NO_HANDLES);
return;
}
@@ -189,24 +231,36 @@ void createHandle (int index) {
*/
int indicatorType = OS.XmONE_OF_MANY;
if ((style & SWT.CHECK) != 0) indicatorType = OS.XmN_OF_MANY;
- int [] argList = {
+ int [] argList = {
+ OS.XmNancestorSensitive, 1,
OS.XmNrecomputeSize, 0,
OS.XmNindicatorType, indicatorType,
OS.XmNalignment, alignment,
OS.XmNborderWidth, borderWidth,
};
- handle = OS.XmCreateToggleButton (parent.handle, null, argList, argList.length / 2);
+ 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 (parent.handle, null, argList, argList.length / 2);
+ 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};
@@ -229,23 +283,22 @@ int defaultFont () {
int defaultForeground () {
return getDisplay ().buttonForeground;
}
-/**
-* Gets the alignment.
-* <p>
-* This method returns the aligment of the button.
-* If the button is an ARROW, the value indicates
-* the direction of the arrow.
-* <p>
-* LEFT, RIGHT, UP, DOWN - when the button is an ARROW button.<br>
-* LEFT, RIGHT, CENTER - when the button is any other style.
-*
-* @return the button alignment
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -273,16 +326,17 @@ boolean getDefault () {
OS.XtGetValues (handle, argList, argList.length / 2);
return argList [1] != 0;
}
-/**
-* Gets the widget image.
-* <p>
-* @return the widget image
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -291,23 +345,21 @@ public Image getImage () {
String getNameText () {
return getText ();
}
-/**
-* Gets the selection.
-* <p>
-* This method gets the widget selection state for a
-* widgets with the style CHECK, RADIO or TOGGLE. It
-* returns false for widgets that do not have one of
-* these styles.
-* true or false - for CHECK, RADIO or TOGGLE.
-* false - for all other widget styles
-*
-* @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
-*/
+/**
+ * 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.
+ *
+ * @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);
@@ -316,27 +368,26 @@ public boolean getSelection () {
OS.XtGetValues (handle, argList, argList.length / 2);
return argList [1] != 0;
}
-/**
-* Gets the widget text.
-* <p>
-* This method returns the button label. The label may
-* include the mnemonic character but must not contain line
-* delimiters.
-*
-* @return the button text
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
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], mnemonic = argList [3];
+ 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 (
@@ -393,12 +444,16 @@ boolean mnemonicMatch (char key) {
}
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);
@@ -422,19 +477,23 @@ void releaseWidget () {
if (disabled != null) disabled.dispose ();
image = bitmap = disabled = null;
}
-/**
-* 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
-*/
+/**
+ * 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);
@@ -459,21 +518,22 @@ void selectRadio () {
}
setSelection (true);
}
-/**
-* Sets the alignment.
-* <p>
-* This method sets the aligment of the button.
-* If the button is an ARROW, the value indicated
-* the direction of the arrow.
-*
-* @param alignment the button alignment or the direction
-* of the arrow if the button is an ARROW
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -541,36 +601,36 @@ void setDefault (boolean value) {
int [] argList = {OS.XmNshowAsDefault, (value ? 1 : 0)};
OS.XtSetValues (handle, argList, argList.length / 2);
}
-/**
-* Sets the widget image.
-* <p>
-* @param image the widget 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
-*/
+/**
+ * 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 SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
setBitmap (this.image = image);
}
-/**
-* Sets the selection.
-* <p>
-* This method Sets the widget selection state for a
-* widgets with the style CHECK, RADIO or TOGGLE. It
-* returns false for widgets that do not have one of
-* these styles.
-*
-* @param selected the new 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
-*/
+/**
+ * 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.
+ *
+ * @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);
@@ -578,21 +638,23 @@ public void setSelection (boolean selected) {
int [] argList = {OS.XmNset, selected ? 1 : 0};
OS.XtSetValues (handle, argList, argList.length / 2);
}
-/**
-* Sets the widget text.
-* <p>
-* This method sets the button label. The label may include
-* the mnemonic character but must not contain line delimiters.
-*
-* @param string the desired label of the button
-*
-* @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
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -619,7 +681,8 @@ public void setText (String string) {
null,
0,
0);
- if (xmString == 0) error (SWT.ERROR_CANNOT_SET_TEXT);
+ 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,
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
index 6a6d902ecd..f8e2d316b2 100755
--- 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
@@ -1,52 +1,67 @@
package org.eclipse.swt.widgets;
/*
-* Licensed Materials - Property of IBM,
-* SWT - The Simple Widget Toolkit,
-* (c) Copyright IBM Corp 1998, 1999.
-*/
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
-/**
-* The canvas class implements a drawing area for
-* arbitrary graphics.
-*
-* Styles
-*
-* NO_BACKGROUND,
-* NO_FOCUS,
-* MERGE_EXPOSES,
-* RESIZE_REDRAW
-*
-* Events
-*
-**/
-
-/* Imports */
import org.eclipse.swt.internal.motif.*;
import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
-/* Class Definition */
+/**
+ * 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 */
}
-/**
-* Create a Canvas.
-*
-* PARAMTERS
-*
-* parent a composite widget (cannot be null)
-* style the bitwise OR'ing of widget styles
-*
-* REMARKS
-*
-* This method creates a child widget using style bits
-* to select a particular look or set of properties.
-*
-**/
+/**
+ * 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);
}
@@ -54,20 +69,24 @@ void createWidget (int index) {
super.createWidget (index);
fontList = defaultFont ();
}
-/**
-* Get the current caret.
-*
-* REMARKS
-*
-* This method gets the current caret for the window.
-* The current caret is automatically hidden and shown
-* by the window when:
-*
-* - during expose and resize
-* - when focus is gained or lost
-* - when an the window is scrolled
-*
-**/
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -109,6 +128,28 @@ void releaseWidget () {
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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -163,24 +204,23 @@ public void setBounds (int x, int y, int width, int height) {
super.setBounds (x, y, width, height);
if (isFocus) caret.setFocus ();
}
-/**
-* Set the current caret.
-*
-* PARAMTERS
-*
-* caret - the new caret or null
-*
-* REMARKS
-*
-* This method sets the current caret for the window.
-* The current caret is automatically hidden and shown
-* by the window when:
-*
-* - during expose and resize
-* - when focus is gained or lost
-* - when an the window is scrolled
-*
-**/
+/**
+ * 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
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the 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);
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
index 818e4d53cd..5274b4443f 100755
--- 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
@@ -1,31 +1,63 @@
package org.eclipse.swt.widgets;
/*
-* Licensed Materials - Property of IBM,
-* SWT - The Simple Widget Toolkit,
-* (c) Copyright IBM Corp 1998, 1999.
-*/
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
-/* Imports */
import org.eclipse.swt.internal.motif.*;
import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
-/**
-* The caret class implements an i-beam that is
-* typically used as the insertion point for text.
-*/
+/**
+ * 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>
+ */
-/* Class Definition */
public /*final*/ class Caret extends Widget {
Canvas parent;
int x, y, width, height;
boolean moved, resized;
boolean isVisible, isShowing;
int blinkRate = 500;
-/**
-* Creates a new instance of the 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 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;
@@ -65,16 +97,17 @@ boolean drawCaret () {
OS.XFreeGC (xDisplay, gc);
return true;
}
-/**
-* Gets the widget bounds.
-* <p>
-* @return a rectangle that is the widget bounds.
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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);
@@ -88,81 +121,84 @@ public Display getDisplay () {
if (parent == null) error (SWT.ERROR_WIDGET_DISPOSED);
return parent.getDisplay ();
}
-/**
-* Gets the widget font.
-* <p>
-* @return the widget font
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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 ();
}
-/**
-* Gets the widget location.
-* <p>
-* @return the widget location
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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);
}
-/**
-* Gets the parent.
-* <p>
-* @return the parent
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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;
}
-/**
-* Gets the widget size.
-* <p>
-* @return the widget size
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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);
}
-/**
-* Gets the visibility state.
-* <p>
-* If the parent is not visible or some other condition
-* makes the widget not visible, the widget can still be
-* considered visible even though it may not actually be
-* showing.
-*
-* @return visible the visibility state
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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);
@@ -175,21 +211,23 @@ boolean hideCaret () {
isShowing = false;
return drawCaret ();
}
-/**
-* Gets the visibility status.
-* <p>
-* This method returns the visibility status of the
-* widget in the widget hierarchy. If the parent is not
-* visible or some other condition makes the widget not
-* visible, this method will return false.
-*
-* @return the actual visibility state
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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);
@@ -218,19 +256,22 @@ void releaseWidget () {
}
parent = null;
}
-/**
-* Sets the widget bounds.
-* <p>
-* @param x the new x coordinate
-* @param y the new y coordinate
-* @param width the new widget width
-* @param height the new widget height
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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);
@@ -259,18 +300,19 @@ public void setBounds (int x, int y, int width, int height) {
}
if (isShowing) showCaret ();
}
-/**
-* Set the widget bounds.
-*
-* @param rect the new bounding rectangle
-*
-* @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 rect is null
-*/
+/**
+ * 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 (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -283,106 +325,110 @@ void setFocus () {
display.setCurrentCaret (this);
if (isVisible) showCaret ();
}
-/**
-* 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(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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 SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the 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);
}
-/**
-* Sets the widget location.
-* <p>
-* @param x the new x position.
-* @param y the new y position.
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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 widget location.
-* <p>
-* @param location the new location
-*
-* @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 location is null
-*/
+/**
+ * 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 widget size.
-* <p>
-* @param x the new width
-* @param y the new height
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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);
setBounds (x, y, width, height);
}
-/**
-* Sets the widget size.
-* <p>
-* @param size the widget size
-*
-* @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 size is null
-*/
+/**
+ * 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);
}
-/**
-* Sets the visibility state.
-* <p>
-* If the parent is not visible or some other condition
-* makes the widget not visible, the widget can still be
-* considered visible even though it may not actually be
-* showing.
-*
-* @param visible the new visibility state
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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);
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
index a57ccd7cda..c598a52931 100755
--- 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
@@ -1,18 +1,27 @@
package org.eclipse.swt.widgets;
/*
-* Licensed Materials - Property of IBM,
-* SWT - The Simple Widget Toolkit,
-* (c) Copyright IBM Corp 1998, 1999.
-*/
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.layout.*;
-/**
- * A color dialog allows the user to select a color
- * from all available colors in the current pallette
+/**
+ * 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 /*final*/ class ColorDialog extends Dialog {
private static final int DEPTH_4 = 0; // index for COLOR_SWATCH_EXTENTS
@@ -38,9 +47,54 @@ public /*final*/ class ColorDialog extends Dialog {
// 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);
}
@@ -89,7 +143,7 @@ void createSampleGroup(int colorChooserWidth) {
GridLayout layout = new GridLayout();
int sampleGroupWidth;
- sampleGroup.setText("Sample");
+ sampleGroup.setText(SWT.getMessage("SWT_Sample"));
gridData.horizontalAlignment = GridData.FILL;
sampleGroup.setLayoutData(gridData);
sampleGroup.setLayout(layout);
@@ -97,7 +151,7 @@ void createSampleGroup(int colorChooserWidth) {
sampleLabel = new Label(sampleGroup, SWT.CENTER | SWT.BORDER);
sampleLabel.setAlignment(SWT.CENTER);
- sampleLabel.setText("A Sample Text");
+ sampleLabel.setText(SWT.getMessage("SWT_A_Sample_Text"));
gridData = new GridData();
gridData.grabExcessHorizontalSpace = true;
gridData.widthHint = sampleGroupWidth;
@@ -116,14 +170,14 @@ void createSelectionGroup() {
GridData gridData = new GridData();
GridLayout layout = new GridLayout();
- selectionGroup.setText("Selection");
+ 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("Current Selection");
+ selectionLabel.setText(SWT.getMessage("SWT_Current_Selection"));
gridData = new GridData();
gridData.grabExcessHorizontalSpace = true;
gridData.horizontalAlignment = GridData.FILL;
@@ -184,6 +238,13 @@ Color [][] getColorGrid() {
int getColorSwatchExtent() {
return colorSwatchExtent;
}
+/**
+ * Returns the currently selected color in the receiver.
+ *
+ * @return the RGB value for the selected color
+ *
+ * @see PaletteData#getRGBs
+ */
public RGB getRGB() {
return dialogResult;
}
@@ -351,6 +412,17 @@ void mouseMove(Event event) {
getSampleCanvas().setBackground(color);
getSampleText().setBackground(color);
}
+/**
+ * Makes the receiver visible and brings it to the front
+ * of the display.
+ *
+ * @return the selected 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 RGB open() {
Color selectionColor;
RGB dialogResult = null;
@@ -375,10 +447,6 @@ public RGB open() {
}
return dialogResult;
}
-/**
- * Insert the method's description here.
- * Creation date: (7/6/99 5:07:09 PM)
- */
void paint(Event event) {
Color colorGrid[][] = getColorGrid();
@@ -388,10 +456,6 @@ void paint(Event event) {
}
}
}
-/**
- * Insert the method's description here.
- * Creation date: (7/6/99 5:07:09 PM)
- */
void setColorDepth(int bits) {
colorDepth = bits;
if (bits == 4) {
@@ -405,8 +469,12 @@ void setColorDepth(int bits) {
initialize8BitColors();
}
}
-/**
- *
+/**
+ * Returns the receiver's selected color to be the argument.
+ *
+ * @param rgb the new RGB value for the selected color
+ *
+ * @see PaletteData#getRGBs
*/
public void setRGB(RGB rgb) {
dialogResult = rgb;
@@ -419,7 +487,7 @@ void createOkCancel() {
GridData gridData;
ok = new Button(dialog, SWT.PUSH);
- ok.setText("OK");
+ ok.setText(SWT.getMessage("SWT_OK"));
dialog.setDefaultButton(ok);
gridData = new GridData();
gridData.horizontalAlignment = GridData.FILL;
@@ -427,7 +495,7 @@ void createOkCancel() {
ok.setLayoutData(gridData);
cancel = new Button(dialog, SWT.PUSH);
- cancel.setText("Cancel");
+ cancel.setText(SWT.getMessage("SWT_Cancel"));
gridData = new GridData();
gridData.horizontalAlignment = GridData.FILL;
gridData.verticalAlignment = GridData.BEGINNING;
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
index 7ff8aa18ec..e1b66be8a7 100755
--- 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
@@ -1,37 +1,54 @@
package org.eclipse.swt.widgets;
/*
-* Licensed Materials - Property of IBM,
-* SWT - The Simple Widget Toolkit,
-* (c) Copyright IBM Corp 1998, 1999.
-*/
-
-/**
-* The combo 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.
-*
-* Styles
-*
-* SIMPLE,
-* DROP_DOWN,
-* READ_ONLY,
-*
-* Events
-*
-* Selection
-*
-**/
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
-/* Imports */
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.*;
-/* Class Definition */
+/**
+ * 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 /*final*/ 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;
/*
@@ -43,32 +60,55 @@ public /*final*/ class Combo extends Composite {
LIMIT = 0x7FFFFFFF;
}
-/**
-* Creates a new instance of the 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 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 an item.
-* <p>
-* The item is placed at the end of the list.
-* Indexing is zero based.
-*
-* This operation can fail when the item cannot
-* be added in the OS.
-*
-* @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 string is null
-* @exception SWTError(ERROR_ITEM_NOT_ADDED)
-* when the operation fails in the OS
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -80,28 +120,32 @@ public void add (String string) {
OS.XmComboBoxAddItem(handle, xmString, -1, false);
OS.XmStringFree (xmString);
}
-/**
-* 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 or the item cannot be added in
-* the OS.
-*
-* @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
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -125,19 +169,25 @@ public void add (String string, int index) {
OS.XmComboBoxAddItem(handle, xmString, index + 1, false);
OS.XmStringFree (xmString);
}
-/**
-* 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
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -145,19 +195,30 @@ public void addModifyListener (ModifyListener listener) {
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
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -196,15 +257,23 @@ static int checkStyle (int style) {
protected void checkSubclass () {
if (!isValidSubclass ()) error (SWT.ERROR_INVALID_SUBCLASS);
}
-/**
-* 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
-*/
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -262,7 +331,9 @@ void createHandle (int index) {
* is to create a parent for the list that will disallow
* geometry requests.
*/
- formHandle = OS.XmCreateForm (parent.handle, null, null, 0);
+ 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) {
@@ -270,7 +341,7 @@ void createHandle (int index) {
} else if ((style & SWT.READ_ONLY) != 0) {
comboBoxType = OS.XmDROP_DOWN_LIST;
}
- int [] argList = {
+ int [] argList2 = {
OS.XmNcomboBoxType, comboBoxType,
OS.XmNtopAttachment, OS.XmATTACH_FORM,
OS.XmNbottomAttachment, OS.XmATTACH_FORM,
@@ -278,25 +349,21 @@ void createHandle (int index) {
OS.XmNrightAttachment, OS.XmATTACH_FORM,
OS.XmNresizable, 0,
};
- handle = OS.XmCreateComboBox (formHandle, null, argList, argList.length / 2);
+ handle = OS.XmCreateComboBox (formHandle, null, argList2, argList2.length / 2);
if (handle == 0) error (SWT.ERROR_NO_HANDLES);
}
-/**
-* 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
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -314,18 +381,20 @@ public void deselect (int index) {
OS.XmListDeselectAllItems (argList[3]);
}
}
-/**
-* 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
-*/
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -341,25 +410,25 @@ public void deselectAll () {
}
-/**
-* 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
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -388,21 +457,19 @@ public String getItem (int index) {
OS.XtFree (address);
return decodeString(new String (Converter.mbcsToWcs (null, buffer)));
}
-/**
-* 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
-*/
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -410,21 +477,20 @@ public int getItemCount () {
OS.XtGetValues (handle, argList, argList.length / 2);
return argList [1];
}
-/**
-* 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
-*/
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -436,21 +502,25 @@ public int getItemHeight () {
/* Result is from empirical analysis on Linux and AIX */
return getFontHeight () + spacing + (2 * highlight);
}
-/**
-* 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
-*/
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -480,16 +550,20 @@ public String [] getItems () {
}
return result;
}
-/**
-* 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
-*/
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -502,19 +576,17 @@ public Point getSelection () {
}
return new Point (start [0], end [0]);
}
-/**
-* 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
-*/
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -533,18 +605,17 @@ public int getSelectionIndex () {
OS.XtFree (address);
return indices [0] - 1;
}
-/**
-* 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
-*/
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -560,21 +631,19 @@ public String getText () {
OS.XtFree (ptr);
return decodeString(new String (Converter.mbcsToWcs (null, buffer)));
}
-/**
-* 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
-*/
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -610,16 +679,19 @@ public int getTextHeight () {
return height;
}
}
-/**
-* 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
-*/
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -637,24 +709,23 @@ void hookEvents () {
OS.XtAddCallback (argList[1], OS.XmNactivateCallback, windowProc, SWT.DefaultSelection);
OS.XtAddCallback (argList[1], OS.XmNvalueChangedCallback, windowProc, SWT.Modify);
}
-/**
-* 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
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -671,25 +742,24 @@ public int indexOf (String string) {
OS.XmStringFree (xmString);
return index - 1;
}
-/**
-* 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
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -713,25 +783,23 @@ public int indexOf (String string, int start) {
if (index == itemCount) return -1;
return index;
}
-/**
-* 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
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -749,27 +817,25 @@ public void remove (int index) {
}
OS.XmComboBoxDeletePos (handle, index + 1);
}
-/**
-* 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
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -797,23 +863,25 @@ void register () {
OS.XtGetValues (handle, argList, argList.length / 2);
WidgetTable.put(argList[1], this);
}
-/**
-* 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
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -831,14 +899,14 @@ public void remove (String string) {
if (index == 0) error (SWT.ERROR_INVALID_ARGUMENT);
OS.XmComboBoxDeletePos (handle, index);
}
-/**
-* 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
-*/
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -857,19 +925,23 @@ public void removeAll () {
OS.XmComboBoxDeletePos(handle, 1);
}
}
-/**
-* 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
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -877,19 +949,23 @@ public void removeModifyListener (ModifyListener listener) {
if (eventTable == null) return;
eventTable.unhook (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
-*/
+/**
+ * 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);
@@ -898,20 +974,18 @@ public void removeSelectionListener (SelectionListener listener) {
eventTable.unhook (SWT.Selection, listener);
eventTable.unhook (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
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -944,27 +1018,27 @@ public void setBounds (int x, int y, int width, int height) {
int newHeight = ((style & SWT.DROP_DOWN) != 0) ? getTextHeight() : height;
super.setBounds (x, y, width, newHeight);
}
-/**
-* 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
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -983,20 +1057,19 @@ public void setItem (int index, String string) {
if (isSelected) OS.XmListSelectPos (argList[1], index + 1, false);
OS.XmStringFree (xmString);
}
-/**
-* 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
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -1025,18 +1098,22 @@ public void setItems (String [] items) {
OS.XtFree (ptr);
if (index < items.length) error (SWT.ERROR_ITEM_NOT_ADDED);
}
-/**
-* 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
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -1080,18 +1157,27 @@ public void setSize (int width, int height) {
int newHeight = ((style & SWT.DROP_DOWN) != 0) ? getTextHeight () : height;
super.setSize (width, newHeight);
}
-/**
-* 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
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -1125,18 +1211,20 @@ public void setText (String string) {
if (IsLinux && (style & SWT.MULTI) != 0) sendEvent (SWT.Modify);
}
}
-/**
-* 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
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
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
index 5177c3bccd..3b1441b524 100755
--- 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
@@ -1,29 +1,31 @@
package org.eclipse.swt.widgets;
/*
-* Licensed Materials - Property of IBM,
-* SWT - The Simple Widget Toolkit,
-* (c) Copyright IBM Corp 1998, 1999.
-*/
-
-/**
-* The composite class represents a user interface object
-* that contains other widgets.
-*
-* Styles
-*
-* H_SCROLL, V_SCROLL
-*
-* Events
-*
-**/
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
-/* Imports */
import org.eclipse.swt.internal.motif.*;
import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
-/* Class Definition */
+/**
+ * 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;
@@ -31,6 +33,34 @@ public class Composite extends Scrollable {
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);
}
@@ -91,13 +121,15 @@ void createHandle (int index) {
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 (parent.handle, null, argList, argList.length / 2);
+ int parentHandle = parent.handle;
+ 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);
@@ -107,15 +139,18 @@ void createHandle (int index) {
}
}
void createScrolledHandle (int topHandle) {
- scrolledHandle = OS.XmCreateMainWindow (topHandle, null, null, 0);
+ 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, 2,
+ OS.XmNshadowThickness, thickness,
};
formHandle = OS.XmCreateForm (scrolledHandle, null, argList1, argList1.length / 2);
if (formHandle == 0) error (SWT.ERROR_NO_HANDLES);
@@ -132,16 +167,15 @@ void createScrolledHandle (int topHandle) {
};
handle = OS.XmCreateDrawingArea (formHandle, null, argList2, argList2.length / 2);
} else {
- int [] argList = {
+ 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, argList, argList.length / 2);
+ handle = OS.XmCreateDrawingArea (scrolledHandle, null, argList3, argList3.length / 2);
}
if (handle == 0) error (SWT.ERROR_NO_HANDLES);
- Display display = getDisplay ();
OS.XtOverrideTranslations (handle, display.tabTranslations);
OS.XtOverrideTranslations (handle, display.arrowTranslations);
}
@@ -170,6 +204,21 @@ public boolean forceFocus () {
}
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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -181,6 +230,17 @@ int getChildrenCount () {
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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -195,19 +255,41 @@ void hookEvents () {
}
}
-/**
-* Lays out the children.
-* <p>
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
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);
@@ -414,6 +496,17 @@ 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 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);
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
index c1a7ed8a6f..af3b234aed 100755
--- 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
@@ -1,40 +1,31 @@
package org.eclipse.swt.widgets;
-/*
-* Licensed Materials - Property of IBM,
-* SWT - The Simple Widget Toolkit,
-* (c) Copyright IBM Corp 1998, 1999.
-*/
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
-/**
-* The widget class is the abstract superclass of all
-* user interface objects. All widgets can be created,
-* disposed and support events.
-*
-* Styles
-*
-* BORDER
-* CLIP_CHILDREN, CLIP_SIBLINGS
-*
-* Events
-*
-* KeyDown, KeyUp,
-* MouseDown, MouseUp, MouseMove,
-* DoubleClick,
-* Paint,
-* Move, Resize,
-* FocusIn, FocusOut,
-*
-**/
-
-/* Imports */
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.*;
-/* Class Definition */
+/**
+ * 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;
@@ -44,24 +35,58 @@ public abstract class Control extends Widget implements Drawable {
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 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
-*/
+/**
+ * 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);
@@ -70,19 +95,25 @@ public void addControlListener(ControlListener listener) {
addListener (SWT.Resize,typedListener);
addListener (SWT.Move,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
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -91,19 +122,25 @@ public void addFocusListener(FocusListener listener) {
addListener(SWT.FocusIn,typedListener);
addListener(SWT.FocusOut,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
-*/
+/**
+ * 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);
@@ -111,19 +148,25 @@ public void addHelpListener (HelpListener listener) {
TypedListener typedListener = new TypedListener (listener);
addListener (SWT.Help, 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
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -132,19 +175,25 @@ public void addKeyListener(KeyListener listener) {
addListener(SWT.KeyUp,typedListener);
addListener(SWT.KeyDown,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
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -154,18 +203,25 @@ public void addMouseListener(MouseListener listener) {
addListener(SWT.MouseUp,typedListener);
addListener(SWT.MouseDoubleClick,typedListener);
}
-/**
-* 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>
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -175,19 +231,25 @@ public void addMouseTrackListener (MouseTrackListener listener) {
addListener (SWT.MouseExit,typedListener);
addListener (SWT.MouseHover,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
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -195,19 +257,25 @@ public void addMouseMoveListener(MouseMoveListener listener) {
TypedListener typedListener = new TypedListener (listener);
addListener(SWT.MouseMove,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
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -215,18 +283,25 @@ public void addPaintListener(PaintListener listener) {
TypedListener typedListener = new TypedListener (listener);
addListener(SWT.Paint,typedListener);
}
-/**
-* 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>
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -234,22 +309,60 @@ public void addTraverseListener (TraverseListener listener) {
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);
}
-/**
-* Computes the preferred size.
-* <p>
-* @param wHint the width hint (can be SWT.DEFAULT)
-* @param hHint the height hint (can be SWT.DEFAULT)
-* @param changed the changed hint (for layouts)
-* @return the preferred size of 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
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -265,8 +378,42 @@ public Point computeSize (int wHint, int hHint, boolean changed) {
void createWidget (int index) {
super.createWidget (index);
- setZOrder ();
- realizeChildren ();
+
+ /*
+ * 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);
}
int defaultBackground () {
return getDisplay ().defaultBackground;
@@ -298,6 +445,19 @@ char findMnemonic (String string) {
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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -306,6 +466,16 @@ public boolean forceFocus () {
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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -316,6 +486,16 @@ int getBackgroundPixel () {
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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -324,6 +504,17 @@ public int getBorderWidth () {
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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -340,14 +531,34 @@ Point getClientLocation () {
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]);
}
-/**
-* Gets the Display.
-*/
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -355,6 +566,16 @@ public boolean getEnabled () {
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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -460,6 +681,16 @@ int getFontList () {
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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -470,11 +701,32 @@ int getForegroundPixel () {
OS.XtGetValues (handle, argList, argList.length / 2);
return argList [1];
}
+/**
+ * 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 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);
@@ -483,11 +735,38 @@ public Point getLocation () {
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 () {
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);
@@ -509,11 +788,39 @@ Control [] getPath () {
}
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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -523,21 +830,39 @@ public Point getSize () {
int borders = argList [5] * 2;
return new Point (argList [1] + borders, argList [3] + borders);
}
-/**
-* 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
-*/
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -577,13 +902,26 @@ void hookEvents () {
int inputContext () {
return getShell ().inputContext ();
}
-public int internal_new_GC (GCData data) {
- if (!OS.XtIsRealized (handle)) {
- int xtParent = handle;
- while ((OS.XtParent (xtParent) != 0) && !OS.XtIsSubclass (xtParent, OS.ShellWidgetClass ())) {
- xtParent = OS.XtParent (xtParent);
- }
- OS.XtRealizeWidget (xtParent);
+/**
+ * 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 (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!OS.XtIsRealized (handle)) {
+ Shell shell = getShell ();
+ shell.realizeWidget ();
}
int xDisplay = OS.XtDisplay (handle);
if (xDisplay == 0) SWT.error(SWT.ERROR_NO_HANDLES);
@@ -605,26 +943,95 @@ public int internal_new_GC (GCData data) {
}
return xGC;
}
-public void internal_dispose_GC (int xGC, GCData data) {
- int xDisplay = OS.XtDisplay (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>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) {
+ 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -647,53 +1054,80 @@ boolean mnemonicHit () {
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 SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
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 SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
setZOrder (control, false);
}
-/**
-* Packs the widget.
-* <p>
-* Packing a widget causes it to be resized to the
-* preferred size for the widget. For a composite,
-* this involves computing the preferred size from
-* the layout.
-*
-* @see Control#computeSize(int, int)
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
pack (true);
}
-/**
-* Packs the widget.
-* <p>
-* Packing a widget causes it to be resized to the
-* preferred size for the widget. For a composite,
-* this involves computing the preferred size from
-* the layout.
-*
-* @param changed the changed hint (for layouts)
-*
-* @see Control#computeSize(int, int)
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -734,7 +1168,8 @@ int processModify (int callData) {
return 0;
}
int processMouseDown (int callData) {
- getDisplay ().hideToolTip ();
+ Display display = getDisplay ();
+ display.hideToolTip ();
XButtonEvent xEvent = new XButtonEvent ();
OS.memmove (xEvent, callData, XButtonEvent.sizeof);
sendMouseEvent (SWT.MouseDown, xEvent.button, xEvent.state, xEvent);
@@ -745,19 +1180,15 @@ int processMouseDown (int callData) {
OS.XmProcessTraversal (handle, OS.XmTRAVERSE_CURRENT);
menu.setVisible (true);
}
- int xDisplay = OS.XtDisplay (handle);
- if (xDisplay != 0) {
- Display display = getDisplay ();
- int clickTime = OS.XtGetMultiClickTime (xDisplay);
- 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.state, xEvent);
- }
- if (eventTime == 0) eventTime = 1;
- display.lastTime = eventTime;
- display.lastButton = eventButton;
+ 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.state, xEvent);
}
+ if (eventTime == 0) eventTime = 1;
+ display.lastTime = eventTime;
+ display.lastButton = eventButton;
return 0;
}
int processMouseEnter (int callData) {
@@ -783,7 +1214,6 @@ 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;
@@ -794,8 +1224,18 @@ int processMouseExit (int callData) {
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) {
- getDisplay ().hideToolTip ();
+ Display display = getDisplay ();
+ display.hideToolTip ();
XButtonEvent xEvent = new XButtonEvent ();
OS.memmove (xEvent, callData, XButtonEvent.sizeof);
sendMouseEvent (SWT.MouseUp, xEvent.button, xEvent.state, xEvent);
@@ -832,10 +1272,10 @@ int processSetFocus (int callData) {
XFocusChangeEvent xEvent = new XFocusChangeEvent ();
OS.memmove (xEvent, callData, XFocusChangeEvent.sizeof);
- /* Ignore focus changes caused by grabbing and ungrabing. */
+ /* Ignore focus changes caused by grabbing and ungrabing */
if (xEvent.mode != OS.NotifyNormal) return 0;
- /* Only process focus callbacks between windows. */
+ /* Only process focus callbacks between windows */
if (xEvent.detail != OS.NotifyAncestor &&
xEvent.detail != OS.NotifyInferior &&
xEvent.detail != OS.NotifyNonlinear) return 0;
@@ -855,46 +1295,52 @@ int processSetFocus (int callData) {
if (widget != 0 && OS.XtClass (widget) == OS.XmMenuShellWidgetClass ()) return 0;
}
- /* Process the focus change for the widget. */
- if (xEvent.type == OS.FocusIn) {
- int result = processFocusIn ();
- 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);
+ /* Process the focus change for the widget */
+ switch (xEvent.type) {
+ case OS.FocusIn: {
+ processFocusIn ();
+ // widget could be disposed at this point
+ if (handle == 0) return 0;
+ 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;
}
- shell.lastFocus = null;
- }
- for (int i=focusIn.length-1; i>=index; --i) {
- focusIn [i].sendEvent (SWT.Activate);
+ for (int i=focusIn.length-1; i>=index; --i) {
+ focusIn [i].sendEvent (SWT.Activate);
+ }
+ break;
}
- return result;
- }
- if (xEvent.type == OS.FocusOut) {
- int result = processFocusOut ();
- 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);
+ case OS.FocusOut: {
+ processFocusOut ();
+ // widget could be disposed at this point
+ if (handle == 0) return 0;
+ 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;
}
- shell.lastFocus = null;
+ break;
}
- return result;
}
return 0;
}
@@ -925,11 +1371,46 @@ void propagateWidget (boolean enabled) {
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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -984,19 +1465,23 @@ void releaseWidget () {
parent = null;
layoutData = null;
}
-/**
-* 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
-*/
+/**
+ * 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);
@@ -1005,19 +1490,23 @@ public void removeControlListener (ControlListener listener) {
eventTable.unhook (SWT.Move, listener);
eventTable.unhook (SWT.Resize, 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
-*/
+/**
+ * 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);
@@ -1026,19 +1515,23 @@ public void removeFocusListener(FocusListener listener) {
eventTable.unhook(SWT.FocusIn, listener);
eventTable.unhook(SWT.FocusOut, 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
-*/
+/**
+ * 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);
@@ -1046,19 +1539,23 @@ public void removeHelpListener (HelpListener listener) {
if (eventTable == null) return;
eventTable.unhook (SWT.Help, 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
-*/
+/**
+ * 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);
@@ -1067,19 +1564,23 @@ public void removeKeyListener(KeyListener listener) {
eventTable.unhook(SWT.KeyUp, listener);
eventTable.unhook(SWT.KeyDown, 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
-*/
+/**
+ * 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);
@@ -1089,19 +1590,23 @@ public void removeMouseListener(MouseListener listener) {
eventTable.unhook(SWT.MouseUp, listener);
eventTable.unhook(SWT.MouseDoubleClick, 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
-*/
+/**
+ * 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);
@@ -1109,18 +1614,23 @@ public void removeMouseMoveListener(MouseMoveListener listener) {
if (eventTable == null) return;
eventTable.unhook(SWT.MouseMove, listener);
}
-/**
-* Removes the listener.
-* <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>
-*/
+/**
+ * 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);
@@ -1130,37 +1640,46 @@ public void removeMouseTrackListener(MouseTrackListener listener) {
eventTable.unhook (SWT.MouseExit, listener);
eventTable.unhook (SWT.MouseHover, 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
-*/
+/**
+ * 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.
-* <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>
-*/
+}/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -1257,6 +1776,18 @@ void sendMouseEvent (int type, int button, int mask, XWindowEvent xEvent) {
if ((mask & OS.Button3Mask) != 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 SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the 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);
@@ -1273,6 +1804,27 @@ void setBackgroundPixel (int pixel) {
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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -1299,10 +1851,40 @@ public void setBounds (int x, int y, int width, int height) {
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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -1325,6 +1907,22 @@ public void setCapture (boolean capture) {
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 SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -1332,9 +1930,7 @@ public void setCursor (Cursor cursor) {
if (display == 0) return;
int window = OS.XtWindow (handle);
if (window == 0) {
- if (OS.XtIsRealized (handle)) return;
- Shell shell = this.getShell ();
- shell.realizeWidget ();
+ if (!OS.XtIsRealized (handle)) getShell ().realizeWidget ();
window = OS.XtWindow (handle);
if (window == 0) return;
}
@@ -1346,6 +1942,19 @@ public void setCursor (Cursor cursor) {
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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -1354,6 +1963,19 @@ public void setEnabled (boolean 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -1362,6 +1984,18 @@ public boolean setFocus () {
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 SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the 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);
@@ -1391,6 +2025,18 @@ void setFontList (int fontList) {
/* 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 SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the 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);
@@ -1444,11 +2090,34 @@ void setKeyState (Event event, XKeyEvent xEvent) {
if ((xEvent.state & OS.Button3Mask) != 0) event.stateMask |= SWT.BUTTON3;
}
}
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -1460,30 +2129,41 @@ public void setLocation (int x, int y) {
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 pop up menu.
-* <p>
-* Every window has a optional pop up menu that is
-* displayed when the user requests a popup menu for
-* the window. 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(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-* @exception SWTError(ERROR_MENU_NOT_POP_UP)
-* when the menu is not a POP_UP
-* @exception SWTError(ERROR_NO_COMMON_PARENT)
-* when the menu is not in the same widget tree
-*/
+/**
+ * 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>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the 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);
@@ -1498,20 +2178,18 @@ public void setMenu (Menu menu) {
this.menu = menu;
}
-/**
- * Changes the parent of the widget to be the one provided if
- * the underlying operating system supports this feature.
- * Answers true if the parent is successfully changed.
- *
- * @param parent Composite
- * the new parent for the control.
- * @return boolean
- * true if parent is changed and false otherwise.
- *
- * @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>
+/**
+ * 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 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -1519,10 +2197,48 @@ public boolean setParent (Composite parent) {
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 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -1541,25 +2257,61 @@ public void setSize (int width, int height) {
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 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
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -1570,25 +2322,6 @@ public void setVisible (boolean visible) {
OS.XtSetMappedWhenManaged (topHandle, visible);
sendEvent (visible ? SWT.Show : SWT.Hide);
}
-void setZOrder () {
- /*
- * 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 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);
- }
- }
-}
void setZOrder (Control control, boolean above) {
/*
* Feature in Xt. We cannot use XtMakeGeometryRequest() to
@@ -1646,6 +2379,21 @@ void setZOrder (Control control, boolean above) {
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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -1653,6 +2401,21 @@ public Point toControl (Point point) {
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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -1743,17 +2506,21 @@ boolean traverseMnemonic (char key) {
if (!isVisible () || !isEnabled ()) return false;
return mnemonicMatch (key) && mnemonicHit ();
}
-/**
-* Traverse the widget.
-* <p>
-* @param traversal the type of traversal.
-* @return true if the traversal succeeded
-*
-* @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>
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -1788,6 +2555,17 @@ boolean traverseReturn () {
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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -1801,13 +2579,4 @@ public void update () {
OS.XtDispatchEvent (event);
}
}
-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;
-}
} \ No newline at end of file
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/CoolBar.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/CoolBar.java
index 236e238b8e..8b6bef2eb6 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/CoolBar.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/CoolBar.java
@@ -1,24 +1,71 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
-/* Imports */
import org.eclipse.swt.internal.*;
import org.eclipse.swt.internal.motif.*;
import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
import java.util.*;
+/**
+ * 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 /*final*/ class CoolBar extends Composite {
Vector rows;
Cursor hoverCursor;
Cursor dragCursor;
static final int ROW_SPACING = 2;
+/**
+ * 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, style);
}
@@ -36,6 +83,24 @@ public Point computeSize (int wHint, int hHint, boolean changed) {
if (hHint != SWT.DEFAULT) extent.y = hHint;
return extent;
}
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -51,6 +116,19 @@ public CoolItem getItem (int index) {
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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -61,6 +139,25 @@ public int getItemCount () {
}
return itemCount;
}
+/**
+ * Returns an array of <code>CoolItems</code>s which are the
+ * items in the receiver in the order those items were added.
+ * <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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -109,6 +206,23 @@ void hookEvents () {
int windowProc = getDisplay ().windowProc;
OS.XtAddEventHandler (handle, OS.ExposureMask, false, windowProc, SWT.Paint);
}
+/**
+ * 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 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 (CoolItem item) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -455,6 +569,27 @@ CoolItem getChild (int id) {
}
return null;
}
+/**
+ * Returns an array of zero-relative indices which map the order
+ * that the items in the receiver were added in (which is the
+ * order that they are returned by <code>getItems()</code>) 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -478,6 +613,18 @@ void setItemOrder (int[] itemOrder) {
rows = new Vector(1);
rows.addElement(row);
}
+/**
+ * Returns an array of points whose x and y coordinates describe
+ * the widths and heights (respectively) of the items in the receiver
+ * in the order the items were added.
+ *
+ * @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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -497,6 +644,18 @@ void setItemSizes (Point[] sizes) {
items[i].setBounds(bounds.x, bounds.y, sizes[i].x, sizes[i].y);
}
}
+/**
+ * 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, in the order the items were added.
+ *
+ * @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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -509,6 +668,19 @@ public int[] getWrapIndices () {
}
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
+ * in the order the items were added.
+ *
+ * @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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -533,6 +705,20 @@ public void setWrapIndices (int[] data) {
rows.addElement(row);
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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/CoolItem.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/CoolItem.java
index 5340a39911..cbd77e60ab 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/CoolItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/CoolItem.java
@@ -1,15 +1,29 @@
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.*;
import org.eclipse.swt.internal.motif.*;
-
-/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
- */
+/**
+ * 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 /*final*/ class CoolItem extends Item {
Control control;
CoolBar parent;
@@ -25,11 +39,72 @@ public /*final*/ class CoolItem extends Item {
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, style);
this.parent = parent;
@@ -38,6 +113,28 @@ public CoolItem (CoolBar parent, int style, int 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -51,14 +148,33 @@ public Point computeSize (int wHint, int hHint) {
void createHandle (int index) {
state |= HANDLE;
int [] argList = {
+ OS.XmNancestorSensitive, 1,
OS.XmNwidth, MINIMUM_WIDTH,
OS.XmNheight, DEFAULT_HEIGHT,
OS.XmNpositionIndex, index,
OS.XmNtraversalOn, 0,
};
- handle = OS.XmCreateDrawingArea(parent.handle, null, argList, argList.length / 2);
+ int parentHandle = parent.handle;
+ handle = OS.XmCreateDrawingArea(parentHandle, null, argList, argList.length / 2);
if (handle == 0) error (SWT.ERROR_NO_HANDLES);
}
+public void dispose () {
+ if (!isValidWidget ()) return;
+ CoolBar 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -66,6 +182,16 @@ public Rectangle getBounds () {
OS.XtGetValues (handle, argList, argList.length / 2);
return new Rectangle ((short) argList [1], (short) argList [3], argList [5], argList [7]);
}
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -81,6 +207,16 @@ Rectangle getGrabberArea () {
OS.XtGetValues (handle, argList, argList.length / 2);
return new Rectangle(0, 0, MINIMUM_WIDTH, argList[1]);
}
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -190,6 +326,17 @@ int processPaint (int callData) {
OS.XFreeGC(xDisplay, xGC);
return 0;
}
+/**
+ * Sets the control which is associated with the receiver
+ * to the argument.
+ *
+ * @param control the new 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 void setControl (Control control) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -242,6 +389,11 @@ void redraw() {
if (window == 0) return;
OS.XClearArea (display, window, 0, 0, 0, 0, true);
}
+void releaseWidget () {
+ super.releaseWidget ();
+ parent = null;
+ control = null;
+}
void setLocation (int x, int y) {
OS.XtMoveWidget (handle, x, y);
if (control != null) {
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
index 27a9612f8a..d9af52cec6 100755
--- 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
@@ -1,32 +1,86 @@
package org.eclipse.swt.widgets;
/*
-* Licensed Materials - Property of IBM,
-* SWT - The Simple Widget Toolkit,
-* (c) Copyright IBM Corp 1998, 1999.
-*/
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
-/**
-* The decorations class implements a widget that
-* looks and behaves like a shell, but has the same
-* properties as a child widget.
-*
-* Styles
-*
-* NO_TRIM,
-* BORDER, RESIZE,
-* TITLE, MENU, MIN, MAX
-*
-* Events
-*
-**/
-
-/* Imports */
import org.eclipse.swt.internal.motif.*;
import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
-/* Class Definition */
+/**
+ * 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;
@@ -39,9 +93,34 @@ public class Decorations extends Canvas {
Decorations () {
/* Do nothing */
}
-/**
-* Creates a new instance of the 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 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));
}
@@ -108,36 +187,99 @@ 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
return defaultButton;
}
-/**
-* Gets the image.
-* <p>
-* @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
-*/
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -146,6 +288,19 @@ public boolean getMinimized () {
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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -189,6 +344,23 @@ void remove (Menu menu) {
}
}
}
+/**
+ * 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 SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -211,6 +383,20 @@ void setDefaultButton (Button button, boolean save) {
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 SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -236,11 +422,45 @@ public void setImage (Image image) {
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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
this.maximized = maximized;
}
+/**
+ * Sets the receiver's menu bar to the argument, which
+ * may be null.
+ *
+ * @param menu the new menu bar
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -298,6 +518,29 @@ public void setMenuBar (Menu menu) {
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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -307,6 +550,21 @@ 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
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
index 28048caa14..2543e841c1 100755
--- 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
@@ -1,29 +1,82 @@
package org.eclipse.swt.widgets;
/*
-* Licensed Materials - Property of IBM,
-* SWT - The Simple Widget Toolkit,
-* (c) Copyright IBM Corp 1998, 1999.
-*/
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
-/* Imports */
import org.eclipse.swt.internal.*;
import org.eclipse.swt.internal.motif.*;
import org.eclipse.swt.*;
-/**
-* A DirectoryDialog allows the user to navigate
-* the file and select a directory.
-*/
+/**
+ * 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>
+ */
-/* Class Definition */
public /*final*/ 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);
}
@@ -32,12 +85,36 @@ int activate (int widget, int client, int call) {
OS.XtUnmanageChild (widget);
return 0;
}
+/**
+ * Returns the path which the receiver will use to filter
+ * the directories it shows.
+ *
+ * @return the filter path
+ */
public String getFilterPath () {
return filterPath;
}
+/**
+ * Returns the receiver's message, which is a description of
+ * the purpose for which it was opened. This message will be
+ * visible on the receiver while it is open.
+ *
+ * @return the message
+ */
public String getMessage () {
return message;
}
+/**
+ * Makes the receiver visible and brings it to the front
+ * of the display.
+ *
+ * @return a string describing the absolute path of the selected directory
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if 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 open () {
/* Get the parent */
@@ -211,9 +288,23 @@ public String open () {
if (cancel) return null;
return directoryPath;
}
+/**
+ * Sets the path which the receiver 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 receiver's message, which is a description of
+ * the purpose for which it was opened. This message will be
+ * visible on the receiver 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
index a842c12ea9..84a51131ea 100755
--- 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
@@ -1,42 +1,85 @@
package org.eclipse.swt.widgets;
/*
-* Licensed Materials - Property of IBM,
-* SWT - The Simple Widget Toolkit,
-* (c) Copyright IBM Corp 1998, 1999.
-*/
-
-/**
-* A display is the class used to represent a group of widgets
-* that are all running in a single thread. Display's implement
-* event dispatching and a synchronous/asynchronous communication
-* mechanism to allow widgets in this thread to be accessed from
-* another thread.
-*
-* A typical application will use multiple threads, but only
-* one display, and therefore only one thread that can directly
-* access widgets. Other threads are typically used to compute
-* a value and communuicate the result to the widget thread.
-* Often, the widget thread will present a user interface that
-* allows the user to cancel or restart a computation. When a
-* computation is performed in the widget thread, events for
-* that thread are not dispatch because the widget thread is
-* doing the compuation, not dispatching the events. In this
-* case, widgets in the thread will not redraw and will not be
-* selectable by the user. On some platforms, the entire user
-* interface for every running program becomes locked. For
-* this reason, it is advisable to run only short computations
-* in the widget thread.
-*
-*
-**/
+ * (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.*;
-public class Display extends Device {
+/**
+ * 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 ();
@@ -77,7 +120,7 @@ public class Display extends Device {
/* Sync/Async Widget Communication */
Synchronizer synchronizer = new Synchronizer (this);
- Thread thread = Thread.currentThread ();
+ Thread thread;
/* Display Shutdown */
Runnable [] disposeList;
@@ -183,6 +226,7 @@ public class Display extends Device {
int crPointer, tabPointer;
/* Xt Translations */
+ int dragTranslations;
int arrowTranslations, tabTranslations;
/* Check Expose Proc */
@@ -190,16 +234,61 @@ public class Display extends Device {
int checkExposeProc;
int exposeCount;
- /* Sleeping */
- int sleepID;
- Callback sleepCallback;
- int sleepProc;
+ /* Wake */
+ Callback wakeCallback;
+ int wakeProc, read_fd, write_fd, inputID;
+ byte [] wake_buffer = new byte [1];
/* Display Data */
Object data;
String [] keys;
- Object [] values;
+ Object [] values;
+
+ static final byte[] _MOTIF_DEFAULT_LOCALE = Converter.wcsToMbcs(null, "_MOTIF_DEFAULT_LOCALE");
+
+ /*
+ * 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);
}
@@ -226,10 +315,25 @@ void addMouseHoverTimeOut (int handle) {
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);
@@ -271,7 +375,8 @@ protected void checkSubclass () {
}
protected void create (DeviceData data) {
checkSubclass ();
- checkDisplay ();
+ checkDisplay ();
+ thread = Thread.currentThread ();
createDisplay (data);
register ();
if (Default == null) Default = this;
@@ -335,11 +440,18 @@ protected void destroy () {
void destroyDisplay () {
/*
* Destroy AppContext (this destroys the display)
- */
+ */
int xtContext = OS.XtDisplayToApplicationContext (xDisplay);
- OS.XtDestroyApplicationContext (xtContext);
+ 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];
@@ -407,19 +519,58 @@ boolean filterEvent (XAnyEvent event) {
/* 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];
@@ -429,6 +580,17 @@ public static synchronized Display findDisplay (Thread thread) {
}
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];
@@ -450,6 +612,16 @@ public Control getCursorControl () {
} 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);
@@ -459,10 +631,41 @@ public Point getCursorLocation () {
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);
@@ -472,14 +675,59 @@ public Object getData (String key) {
}
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];
@@ -499,9 +747,30 @@ public Control getFocusControl () {
} 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 ();
/*
@@ -529,31 +798,39 @@ public Shell [] getShells () {
}
return result;
}
-/**
- * Returns the thread that has invoked <code>syncExec</code>
- * or <code>asyncExec</code>, or null if no such runnable is
- * currently being invoked by the user-interface thread.
- *
- * @return the receiver's sync/async-interface thread
+/**
+ * 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;
}
-/**
-* Get a system color
-*
-* RETURNS
-*
-* A color that corresponds to a system color.
-*
-* REMARKS
-*
-* This method returns the color corresponding to a
-* system color constant. All system color constants
-* begin with the prefix COLOR_.
-*
-**/
+/**
+ * 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;
@@ -583,10 +860,35 @@ public Color getSystemColor (int 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;
@@ -768,16 +1070,24 @@ void initializeDisplay () {
checkExposeCallback = new Callback (this, "checkExposeProc", 3);
checkExposeProc = checkExposeCallback.getAddress ();
if (checkExposeProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS);
- sleepCallback = new Callback (this, "sleepProc", 2);
- sleepProc = sleepCallback.getAddress ();
- if (sleepProc == 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 xtAppContext = OS.XtDisplayToApplicationContext (xDisplay);
+ inputID = OS.XtAppAddInput (xtAppContext, read_fd, OS.XtInputReadMask, wakeProc, 0);
+
/*
* 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,
};
@@ -955,9 +1265,24 @@ void initializeTranslations () {
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");
-// overrideDragTranslations = OS.XtParseTranslationTable (buffer3);
-}
+ 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) {
int xDrawable = OS.XDefaultRootWindow (xDisplay);
int xGC = OS.XCreateGC (xDisplay, xDrawable, 0, null);
@@ -972,6 +1297,21 @@ public int internal_new_GC (GCData data) {
}
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);
}
@@ -1010,19 +1350,41 @@ void postEvent (Event event) {
}
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) {
+ if (status != 0) {
if ((status & OS.XtIMTimer) != 0) {
OS.XtAppProcessEvent (xtContext, OS.XtIMTimer);
- runAsyncMessages ();
- }
- if ((status & OS.XtIMAlternateInput) != 0) {
- OS.XtAppProcessEvent (xtContext, OS.XtIMAlternateInput);
+ }
+ if ((status & OS.XtIMAlternateInput) != 0) {
+ OS.XtAppProcessEvent (xtContext, OS.XtIMAlternateInput);
+// runAsyncMessages ();
}
- if ((status & OS.XtIMXEvent) != 0) {
+ if ((status & OS.XtIMXEvent) != 0) {
OS.XtAppNextEvent (xtContext, xEvent);
if (filterEvent (xEvent)) return false;
OS.XtDispatchEvent (xEvent);
@@ -1045,7 +1407,6 @@ synchronized void register () {
Displays = newDisplays;
}
protected void release () {
- super.release ();
/* Release shells */
Shell [] shells = WidgetTable.shells ();
@@ -1068,9 +1429,16 @@ protected void release () {
/* Release synchronizer */
synchronizer.releaseSynchronizer ();
synchronizer = null;
- releaseDisplay ();
+ releaseDisplay ();
+
+ super.release ();
}
-void releaseDisplay () {
+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;
@@ -1079,8 +1447,8 @@ void releaseDisplay () {
/* Dispose the timer callback */
if (timerIDs != null) {
- for (int i=0; i<=timerIDs.length; i++) {
- OS.XtRemoveTimeOut (timerIDs [i]);
+ for (int i=0; i<timerIDs.length; i++) {
+ if (timerIDs [i] != 0) OS.XtRemoveTimeOut (timerIDs [i]);
}
}
timerIDs = null;
@@ -1089,23 +1457,24 @@ void releaseDisplay () {
timerCallback.dispose ();
timerCallback = null;
- /* Dispose the mouse hover callback */
+ /* Dispose the mouse hover callback */
if (mouseHoverID != 0) OS.XtRemoveTimeOut (mouseHoverID);
mouseHoverID = mouseHoverProc = mouseHoverHandle = toolTipHandle = 0;
mouseHoverCallback.dispose ();
mouseHoverCallback = null;
-
- /* Dispose the sleep callback */
- if (sleepID != 0) OS.XtRemoveTimeOut (sleepID);
- sleepID = sleepProc = 0;
- sleepCallback.dispose ();
- sleepCallback = null;
-
+
/* Dispose window and expose callbacks */
windowCallback.dispose (); windowCallback = null;
checkExposeCallback.dispose (); checkExposeCallback = null;
checkExposeProc = 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);
@@ -1123,10 +1492,7 @@ void releaseDisplay () {
/* Free the translations (no documentation describes how to do this) */
//OS.XtFree (arrowTranslations);
//OS.XtFree (tabTranslations);
-
- /* Destroy the hidden Override shell parent */
- if (shellHandle != 0) OS.XtDestroyWidget (shellHandle);
- shellHandle = 0;
+ //OS.XtFree (dragTranslations);
/* Release references */
thread = null;
@@ -1143,9 +1509,7 @@ void releaseToolTipHandle (int handle) {
if (toolTipHandle != 0) {
int shellHandle = OS.XtParent(toolTipHandle);
int shellParent = OS.XtParent(shellHandle);
- if (handle == shellParent) {
- toolTipHandle = 0;
- }
+ if (handle == shellParent) toolTipHandle = 0;
}
}
void removeMouseHoverTimeOut () {
@@ -1190,6 +1554,13 @@ boolean runDeferredEvents () {
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;
}
@@ -1203,6 +1574,30 @@ void setCurrentCaret (Caret caret) {
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);
@@ -1250,10 +1645,45 @@ public void setData (String key, Object 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);
@@ -1267,22 +1697,22 @@ void showToolTip (int handle, String toolTipText) {
return;
}
- /* Create the tooltip widgets. */
+ /* Create the tooltip widgets */
int widgetClass = OS.OverrideShellWidgetClass ();
- int [] argList = {OS.XmNmwmDecorations, 0, OS.XmNborderWidth, 1};
- int shellHandle = OS.XtCreatePopupShell (null, widgetClass, handle, argList, argList.length / 2);
+ int [] argList1 = {OS.XmNmwmDecorations, 0, OS.XmNborderWidth, 1};
+ int shellHandle = OS.XtCreatePopupShell (null, widgetClass, handle, argList1, argList1.length / 2);
toolTipHandle = OS.XmCreateLabel(shellHandle, null, null, 0);
- /* Set the tooltip foreground and background. */
+ /* Set the tooltip foreground and background */
Color infoForeground = getSystemColor(SWT.COLOR_INFO_FOREGROUND);
Color infoBackground = getSystemColor(SWT.COLOR_INFO_BACKGROUND);
int foregroundPixel = (infoForeground == null) ? defaultForeground : infoForeground.handle.pixel;
int backgroundPixel = (infoBackground == null) ? defaultBackground : infoBackground.handle.pixel;
int [] argList2 = {OS.XmNforeground, foregroundPixel, OS.XmNbackground, backgroundPixel};
OS.XtSetValues (toolTipHandle, argList2, argList2.length / 2);
- OS.XtManageChild(toolTipHandle);
+ OS.XtManageChild (toolTipHandle);
- /* Set the tooltip label string. */
+ /* Set the tooltip label string */
byte [] buffer = Converter.wcsToMbcs (null, toolTipText, true);
int xmString = OS.XmStringParseText (
buffer,
@@ -1295,44 +1725,83 @@ void showToolTip (int handle, String toolTipText) {
int [] argList3 = {OS.XmNlabelString, xmString};
OS.XtSetValues (toolTipHandle, argList3, argList3.length / 2);
if (xmString != 0) OS.XmStringFree (xmString);
-
- /* Position and popup the tooltip. */
- int xWindow = OS.XDefaultRootWindow (xDisplay);
- int [] rootX = new int [1], rootY = new int [1], unused = new int [1];
- OS.XQueryPointer (xDisplay, xWindow, unused, unused, rootX, rootY, unused, unused, unused);
-
+
/*
* 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 x = rootX [0] + 16, y = rootY [0] + 16;
- OS.XtMoveWidget (shellHandle, x, y);
+ */
+ int xWindow = OS.XDefaultRootWindow (xDisplay);
+ int [] rootX = new int [1], rootY = new int [1], unused = new int [1];
+ OS.XQueryPointer (xDisplay, xWindow, unused, unused, rootX, rootY, unused, unused, unused);
+ int x = rootX [0] + 16, y = rootY [0] + 16;
+
+ /*
+ * Ensure that the tooltip 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);
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 ();
int xtContext = OS.XtDisplayToApplicationContext (xDisplay);
- /*
- * Bug in Motif. For some reason, when a time out
- * is added from another thread while the display
- * thread inside of a call-in, it fails to wake up
- * the display event thread. The fix is to limit
- * the maximum time spent waiting for an event.
- */
- sleepID = OS.XtAppAddTimeOut (xtContext, 50, sleepProc, 0);
- boolean result = OS.XtAppPeekEvent (xtContext, xEvent);
- if (sleepID != 0) OS.XtRemoveTimeOut (sleepID);
- sleepID = 0;
- return result;
-}
-int sleepProc (int index, int id) {
- sleepID = 0;
- return 0;
-}
+ return OS.XtAppPeekEvent (xtContext, xEvent);
+}
+/**
+ * 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.
+ *
+ * @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;
+ byte [] textBuffer = Converter.wcsToMbcs (null, string, true);
+ int xmString = OS.XmStringGenerate (textBuffer, null, OS.XmCHARSET_TEXT, _MOTIF_DEFAULT_LOCALE);
+ 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];
@@ -1388,14 +1857,108 @@ public void update () {
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);
- int xtContext = OS.XtDisplayToApplicationContext (xDisplay);
- if (OS.XtAppPending (xtContext) == 0) OS.XtAppAddTimeOut (xtContext, 0, 0, 0);
+ 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 && Character.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 && !Character.isWhitespace (text.charAt (i))) {
+ i++;
+ }
+ wordEnd = i - 1;
+ String line = text.substring (lineStart, wordEnd + 1);
+ int lineWidth = textWidth (line, fontList);
+ while (i < lineEnd && Character.isWhitespace (text.charAt (i))) {
+ i++;
+ }
+ if (lineWidth > width) {
+ if (lastStart == wordStart) {
+ line = text.substring (lineStart, wordStart + 1);
+ lineWidth = textWidth (line, fontList);
+ while (wordStart < wordEnd && lineWidth < width) {
+ 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
index 0b7a79abb5..8603df10fd 100755
--- 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
@@ -1,20 +1,27 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * SWT - The Simple Widget Toolkit,
- * (c) Copyright IBM Corp 1998, 1999.
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
-
+
import org.eclipse.swt.internal.*;
import org.eclipse.swt.internal.motif.*;
import org.eclipse.swt.*;
-/**
- * A file dialog allows the user to navigate the file
- * system and select a file name or type in a new name.
- * The file name is not verified for correctness.
- *
+/**
+ * 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 /*final*/ class FileDialog extends Dialog {
String [] filterNames = new String [0];
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
index cbc3f4532a..ea7088a92a 100755
--- 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
@@ -1,20 +1,23 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * SWT - The Simple Widget Toolkit,
- * (c) Copyright IBM Corp 1998, 1999.
+ * (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.*;
-/**
- * A FontDialog allows the user to select a font
- * from all available fonts in the system.
+/**
+ * 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 /*final*/ class FontDialog extends Dialog {
private static final String TEXT_SAMPLE = "AaBbYyZz";
@@ -118,9 +121,9 @@ void createChildren() {
dialog.setLayout(layout);
// row one
- characterSetLabel.setText("Character set:");
- faceNameLabel.setText("Font:");
- extendedStyleLabel.setText("Extended style:");
+ 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);
@@ -159,9 +162,9 @@ void createChildren() {
// row five
fontSizeLabel = new Label(dialog, SWT.NULL);
- fontSizeLabel.setText("Size:");
+ fontSizeLabel.setText(SWT.getMessage("SWT_Size") + ":");
fontStyleLabel = new Label(dialog, SWT.NULL);
- fontStyleLabel.setText("Style:");
+ fontStyleLabel.setText(SWT.getMessage("SWT_Style") + ":");
fillLabel = new Label(dialog, SWT.NULL);
gridData = new GridData();
@@ -194,7 +197,7 @@ void createChildren() {
// row eight
sampleGroup = new Group(dialog, SWT.NULL);
- sampleGroup.setText("Sample");
+ sampleGroup.setText(SWT.getMessage("SWT_Sample"));
gridData = new GridData();
gridData.heightHint = 70;
gridData.horizontalSpan = 3;
@@ -219,34 +222,34 @@ void createChildren() {
dialog.setSize(445, 410);
}
/**
- * Answer the combo used to display all available character sets.
+ * Returns the combo used to display all available character sets.
*/
Combo getCharacterSetCombo() {
return characterSet;
}
/**
- * Answer the combo used to display all extended styles of
+ * Returns the combo used to display all extended styles of
* the selected font.
*/
Combo getExtStyleCombo() {
return extendedStyle;
}
/**
- * Answer the combo used to display the face names of the
+ * Returns the combo used to display the face names of the
* fonts in the selected character set.
*/
Combo getFaceNameCombo() {
return faceName;
}
/**
- * Answer the FontData for the selected font.
- * Answer null if no font was selected and the dialog was cancelled.
+ * Returns the FontData for the selected font.
+ * Returns null if no font was selected and the dialog was cancelled.
*/
public FontData getFontData() {
return dialogResult;
}
/**
- * Answer the collection of fonts that are displayed by the
+ * 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.
@@ -262,13 +265,13 @@ Font getSampleFont() {
return sampleFont;
}
/**
- * Answer the label used to display a sample of the selected font.
+ * Returns the label used to display a sample of the selected font.
*/
Label getSampleLabel() {
return sampleLabel;
}
/**
- * Answer the selected character set in the format used to load
+ * Returns the selected character set in the format used to load
* fonts.
*/
String getSelectedCharSet() {
@@ -286,7 +289,7 @@ String getSelectedCharSet() {
return platformCharSet;
}
/**
- * Answer the selected face name in the format used to load
+ * Returns the selected face name in the format used to load
* fonts.
*/
String getSelectedFaceName() {
@@ -304,7 +307,7 @@ String getSelectedFaceName() {
return platformFaceName;
}
/**
- * Answer the selected font foundry in the format used to load
+ * Returns the selected font foundry in the format used to load
* fonts.
*/
String getSelectedFoundry() {
@@ -319,7 +322,7 @@ String getSelectedFoundry() {
return foundry;
}
/**
- * Answer a FontData object that can be used to load the selected
+ * Returns a FontData object that can be used to load the selected
* font.
*/
FontData getSelectionFontData() {
@@ -359,21 +362,21 @@ FontData getSelectionFontData() {
return fontData;
}
/**
- * Answer the combo box used to display the available sizes of
+ * Returns the combo box used to display the available sizes of
* the selected font.
*/
Combo getSizeCombo() {
return fontSize;
}
/**
- * Answer the combo box used to display the available styles of
+ * Returns the combo box used to display the available styles of
* the selected font.
*/
Combo getStyleCombo() {
return fontStyle;
}
/**
- * Answer the character set found in 'fontData' prefixed
+ * Returns the character set found in 'fontData' prefixed
* with a string explaining the character set.
*/
String getTranslatedCharSet(FontData fontData) {
@@ -416,7 +419,7 @@ String getTranslatedCharSet(FontData fontData) {
return translatedCharSet;
}
/**
- * Answer the face name as specified in FontData.familyName followed by
+ * 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
@@ -772,7 +775,7 @@ void createOkCancel() {
GridData gridData;
ok = new Button(dialog, SWT.PUSH);
- ok.setText("OK");
+ ok.setText(SWT.getMessage("SWT_OK"));
dialog.setDefaultButton(ok);
gridData = new GridData();
gridData.horizontalAlignment = GridData.FILL;
@@ -780,37 +783,32 @@ void createOkCancel() {
ok.setLayoutData(gridData);
cancel = new Button(dialog, SWT.PUSH);
- cancel.setText("Cancel");
+ cancel.setText(SWT.getMessage("SWT_Cancel"));
gridData = new GridData();
gridData.horizontalAlignment = GridData.FILL;
gridData.verticalAlignment = GridData.BEGINNING;
cancel.setLayoutData(gridData);
}
/**
- * Answer the cancel button
+ * Returns the cancel button
*/
Button getCancelButton() {
return cancel;
}
/**
- * Answer the dialog shell.
+ * Returns the dialog shell.
*/
Shell getDialogShell() {
return shell;
}
/**
- * Answer the ok button.
+ * Returns the ok button.
*/
Button getOKButton() {
return ok;
}
-/**
- * Insert the method's description here.
- * Creation date: (08/05/99 12:34:43)
- * @return boolean
- */
boolean isOkSelected() {
return okSelected;
}
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
index aa9305d0c9..79640e1bbf 100755
--- 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
@@ -1,9 +1,8 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * SWT - The Simple Widget Toolkit,
- * (c) Copyright IBM Corp 1998, 1999.
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import java.util.*;
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
index 30fa605f6f..686748b675 100755
--- 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
@@ -1,11 +1,10 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * SWT - The Simple Widget Toolkit,
- * (c) Copyright IBM Corp 1998, 1999.
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
-
+
import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
import java.util.*;
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
index f68d4fc4d0..65b797c6c5 100755
--- 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
@@ -1,29 +1,34 @@
package org.eclipse.swt.widgets;
/*
-* Licensed Materials - Property of IBM,
-* SWT - The Simple Widget Toolkit,
-* (c) Copyright IBM Corp 1998, 1999.
-*/
-
-/* Imports */
+ * (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.*;
-/**
-* The group class implements an etched border with that
-* is typically used to group radio buttons. A group can
-* have an optional label.
-* <p>
-* <b>Styles</b><br>
-* <dd>SHADOW_IN, SHADOW_OUT,<br>
-* <dd>SHADOW_ETCHED_IN, SHADOW_ETCHED_OUT<br>
-* <br>
-*/
+/**
+ * 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>
+ */
-/* Class Definition */
public /*final*/ class Group extends Composite {
int labelHandle;
/**
@@ -83,8 +88,12 @@ void createHandle (int index) {
* the list that will disallow geometry requests.
*/
int border = (style & SWT.BORDER) != 0 ? 1 : 0;
- int [] argList1 = {OS.XmNborderWidth, border};
- formHandle = OS.XmCreateForm (parent.handle, null, argList1, argList1.length / 2);
+ 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 (),
@@ -117,9 +126,6 @@ void enableWidget (boolean enabled) {
int fontHandle () {
return labelHandle;
}
-/**
-* Gets the client area.
-*/
public Rectangle getClientArea () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -146,16 +152,18 @@ public Rectangle getClientArea () {
}
return new Rectangle (x, y, width, height);
}
-/**
-* Gets the widget text.
-* <p>
-* @return the text
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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);
@@ -202,18 +210,21 @@ void releaseHandle () {
super.releaseHandle ();
labelHandle = 0;
}
-/**
-* Sets the widget text.
-* <p>
-* @param string the string
-*
-* @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
-*/
+/**
+ * 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);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Header.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Header.java
index 0c2e37f0b6..c77ad8aa33 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Header.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Header.java
@@ -1,14 +1,14 @@
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.util.*;
-
-/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
- */
/**
* A header draws one or more header items. Each item may have a text
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
index 0bb0d5548a..290359e958 100755
--- 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
@@ -1,32 +1,65 @@
package org.eclipse.swt.widgets;
/*
-* Licensed Materials - Property of IBM,
-* SWT - The Simple Widget Toolkit,
-* (c) Copyright IBM Corp 1998, 1999.
-*/
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
-/* Imports */
import org.eclipse.swt.internal.*;
import org.eclipse.swt.internal.motif.*;
import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
-/**
-* A label is a non-selectable user interface object
-* that represents displays a static value.
-*
-* <b>Styles</b><br>
-* <dd>SEPARATOR, HORIZONTAL, VERTICAL, SHADOW_IN, SHADOW_OUT<br>
-*/
+/**
+ * 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>
+ */
-/* Class Definition */
public /*final*/ class Label extends Control {
+ String text = "";
Image image, bitmap, disabled;
-/**
-* Creates a new instance of the 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 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));
}
@@ -34,9 +67,6 @@ static int checkStyle (int style) {
if ((style & SWT.SEPARATOR) != 0) return style;
return checkBits (style, SWT.LEFT, SWT.CENTER, SWT.RIGHT, 0, 0, 0);
}
-/**
-* Computes the preferred size.
-*/
public Point computeSize (int wHint, int hHint, boolean changed) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -52,31 +82,46 @@ public Point computeSize (int wHint, int hHint, boolean changed) {
if (hHint != SWT.DEFAULT) height = hHint + (border * 2);
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;
+ 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.XmNfontList, 0, /* 1 */
+ OS.XmNmarginTop, 0, /* 3 */
+ OS.XmNmarginBottom, 0, /* 5 */
+ OS.XmNmarginHeight, 0, /* 7 */
+ };
+ OS.XtGetValues (handle, argList4, argList4.length / 2);
+ Display display = getDisplay ();
+ String string = display.wrapText (text, argList4 [1], wHint);
+ GC gc = new GC(this);
+ Point extent = gc.textExtent(string);
+ gc.dispose();
+ height = extent.y + argList4 [3] + argList4 [5] + argList4 [7] * 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 button's labelType is XmSTRING but it
+ * 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.
*/
- 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 ();
- width = 0;
- }
+ 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);
@@ -84,16 +129,18 @@ public Point computeSize (int wHint, int hHint, boolean changed) {
}
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 (parent.handle, null, argList, argList.length / 2);
+ handle = OS.XmCreateSeparator (parentHandle, null, argList, argList.length / 2);
if (handle == 0) error (SWT.ERROR_NO_HANDLES);
return;
}
@@ -101,11 +148,12 @@ void createHandle (int index) {
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 (parent.handle, null, argList, argList.length / 2);
+ handle = OS.XmCreateLabel (parentHandle, null, argList, argList.length / 2);
if (handle == 0) error (SWT.ERROR_NO_HANDLES);
}
int defaultBackground () {
@@ -117,16 +165,20 @@ int defaultFont () {
int defaultForeground () {
return getDisplay ().labelForeground;
}
-/**
-* Gets the alignment.
-* <p>
-* @return the alignment
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -139,16 +191,17 @@ public int getAlignment () {
if (alignment == OS.XmALIGNMENT_END)return SWT.RIGHT;
return SWT.LEFT;
}
-/**
-* Gets the widget image.
-* <p>
-* @return the widget image
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -157,63 +210,23 @@ public Image getImage () {
String getNameText () {
return getText ();
}
-/**
-* Gets the widget text.
-* <p>
-* @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
-*/
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
if ((style & SWT.SEPARATOR) != 0) return "";
- int [] argList = {OS.XmNlabelString, 0, OS.XmNmnemonic, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- int xmString = argList [1], mnemonic = argList [3];
- if (xmString == 0) error (SWT.ERROR_CANNOT_GET_TEXT);
- char [] result = null;
- int [] parseTable = getDisplay ().parseTable;
- int address = OS.XmStringUnparse (
- xmString,
- null,
- OS.XmCHARSET_TEXT,
- OS.XmCHARSET_TEXT,
- parseTable,
- parseTable.length,
- 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 (null, 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);
-}
-boolean getWrap () {
- return false;
+ return text;
}
boolean mnemonicHit () {
Composite control = this.parent;
@@ -237,15 +250,15 @@ boolean mnemonicMatch (char key) {
if (mnemonic == '\0') return false;
return Character.toUpperCase (key) == Character.toUpperCase (mnemonic);
}
-void propagateHandle (boolean enabled, int widgetHandle) {
- super.propagateHandle (enabled, widgetHandle);
+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 (widgetHandle, argList, argList.length / 2);
+ OS.XtSetValues (handle, argList, argList.length / 2);
}
}
void releaseWidget () {
@@ -264,16 +277,19 @@ int separatorType () {
if ((style & (SWT.SHADOW_OUT)) != 0) return OS.XmSHADOW_ETCHED_OUT;
return OS.XmSHADOW_ETCHED_IN;
}
-/**
-* Sets the alignment.
-* <p>
-* @param aligment
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -326,64 +342,93 @@ void setBitmap (Image image) {
};
OS.XtSetValues (handle, argList, argList.length / 2);
}
-/**
-* Sets the widget image.
-* <p>
-* @param image the widget 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 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 SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
setBitmap (this.image = image);
}
-/**
-* Set the widget text.
-*
-* PARAMETERS
-*
-* string - the new label for the widget
-*
-* REMARKS
-*
-* This method sets the widget label. The label may include
-* the mnemonic characters and line delimiters.
-*
-**/
-/**
-* 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 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) {
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;
- char [] text = new char [string.length ()];
- string.getChars (0, text.length, text, 0);
+ 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 < 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];
+ 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 < text.length) text [j++] = 0;
- byte [] buffer = Converter.wcsToMbcs (null, text, true);
+ 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.XmNfontList, 0, /* 1 */
+ OS.XmNwidth, 0, /* 3 */
+ OS.XmNmarginLeft, 0, /* 5 */
+ OS.XmNmarginRight, 0, /* 7 */
+ OS.XmNborderWidth, 0, /* 9 */
+ OS.XmNmarginWidth, 0, /* 11 */
+ };
+ OS.XtGetValues (handle, argList, argList.length / 2);
+ int width = argList [3] - argList [5] - argList [7] - argList [9] * 2 - argList [11] * 2;
+ Display display = getDisplay ();
+ if (mnemonic != 0) string = new String(unicode);
+ string = display.wrapText (string, argList [1], width);
+ buffer = Converter.wcsToMbcs (null, string, true);
+ } else {
+ buffer = Converter.wcsToMbcs (null, unicode, true);
+ }
+
int [] parseTable = getDisplay ().parseTable;
int xmString = OS.XmStringParseText (
buffer,
@@ -393,7 +438,8 @@ public void setText (String string) {
parseTable,
parseTable.length,
0);
- if (xmString == 0) error (SWT.ERROR_CANNOT_SET_TEXT);
+ 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,
@@ -402,7 +448,4 @@ public void setText (String string) {
OS.XtSetValues (handle, argList, argList.length / 2);
if (xmString != 0) OS.XmStringFree (xmString);
}
-void setWrap (boolean wrap) {
- // NOT DONE
-}
}
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
index 9d77400dc8..148b752474 100755
--- 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
@@ -1,12 +1,10 @@
package org.eclipse.swt.widgets;
/*
-* Licensed Materials - Property of IBM,
-* SWT - The Simple Widget Toolkit,
-* (c) Copyright IBM Corp 1998, 1999.
-*/
-
-/* Imports */
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
import org.eclipse.swt.internal.*;
import org.eclipse.swt.internal.motif.*;
import org.eclipse.swt.*;
@@ -14,27 +12,52 @@ import org.eclipse.swt.graphics.*;
import org.eclipse.swt.events.*;
-/**
-* The list class represents a selectable user interface object
-* that display a list of items and issues notificiation when an
-* item is selected from the list. A list may be single or multi
-* select.
-* <p>
-* <b>Styles</b><br>
-* <dd>SINGLE, MULTI,<br>
-* <dd>H_SCROLL, V_SCROLL<br>
-* <br>
-* <b>Events</b><br>
-* <dd>Selection<br>
-* <dd>DoubleSelection<br>
-*/
+/**
+ * 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>
+ */
-/* Class Definition */
public /*final*/ class List extends Scrollable {
int rows, columns;
-/**
-* Creates a new instance of the 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 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
@@ -45,26 +68,24 @@ public List (Composite parent, int style) {
*/
super (parent, checkStyle (style | SWT.V_SCROLL));
}
-/**
-* Adds an item.
-* <p>
-* The item is placed at the end of the list.
-* Indexing is zero based.
-*
-* This operation can fail when the item cannot
-* be added in the OS.
-*
-* @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 string is null
-* @exception SWTError(ERROR_ITEM_NOT_ADDED)
-* when the operation fails in the OS
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -75,28 +96,32 @@ public void add (String string) {
OS.XmListAddItemUnselected (handle, xmString, 0);
OS.XmStringFree (xmString);
}
-/**
-* 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 or the item cannot be added in
-* the OS.
-*
-* @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
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -119,19 +144,30 @@ public void add (String string, int index) {
OS.XmListAddItemUnselected (handle, xmString, index + 1);
OS.XmStringFree (xmString);
}
-/**
-* 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
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -143,9 +179,6 @@ public void addSelectionListener(SelectionListener listener) {
static int checkStyle (int style) {
return checkBits (style, SWT.SINGLE, SWT.MULTI, 0, 0, 0, 0);
}
-/**
-* Computes the preferred size.
-*/
public Point computeSize (int wHint, int hHint, boolean changed) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -176,9 +209,6 @@ public Point computeSize (int wHint, int hHint, boolean changed) {
Rectangle rect = computeTrim (0, 0, width, height);
return new Point (rect.width, rect.height);
}
-/**
-* Computes the trim.
-*/
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);
@@ -234,7 +264,9 @@ void createHandle (int index) {
* is to create a parent for the list that will disallow
* geometry requests.
*/
- formHandle = OS.XmCreateForm (parent.handle, null, null, 0);
+ 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) {
@@ -242,7 +274,7 @@ void createHandle (int index) {
if ((style & SWT.SIMPLE) != 0) selectionPolicy = OS.XmMULTIPLE_SELECT;
}
if ((style & SWT.H_SCROLL) == 0) listSizePolicy = OS.XmVARIABLE;
- int [] argList = {
+ int [] argList2 = {
OS.XmNlistSizePolicy, listSizePolicy,
OS.XmNselectionPolicy, selectionPolicy,
OS.XmNtopAttachment, OS.XmATTACH_FORM,
@@ -253,10 +285,10 @@ void createHandle (int index) {
// OS.XmNmatchBehavior, OS.XmNONE,
};
if ((style & (SWT.H_SCROLL | SWT.V_SCROLL)) == 0) {
- handle = OS.XmCreateList (formHandle, null, argList, argList.length / 2);
+ handle = OS.XmCreateList (formHandle, null, argList2, argList2.length / 2);
if (handle == 0) error (SWT.ERROR_NO_HANDLES);
} else {
- handle = OS.XmCreateScrolledList (formHandle, null, argList, argList.length / 2);
+ handle = OS.XmCreateScrolledList (formHandle, null, argList2, argList2.length / 2);
if (handle == 0) error (SWT.ERROR_NO_HANDLES);
scrolledHandle = OS.XtParent (handle);
}
@@ -273,22 +305,18 @@ int defaultFont () {
int defaultForeground () {
return getDisplay ().listForeground;
}
-/**
-* 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
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -298,26 +326,21 @@ public void deselect (int index) {
*/
if (index != -1) OS.XmListDeselectPos (handle, index + 1);
}
-/**
-* Deselects a range of items.
-* <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. The range of items
-* is from the start index up to and including
-* the end index.
-
-* @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
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -331,24 +354,23 @@ public void deselect (int start, int end) {
if (index != 0) OS.XmListDeselectPos (handle, index);
}
}
-/**
-* Deselects items.
-* <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 indices the indices of the 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 the indices are null
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -362,47 +384,53 @@ public void deselect (int [] indices) {
if (index != 0) OS.XmListDeselectPos (handle, 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
-*/
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
return OS.XmListGetKbdItemPos (handle) - 1;
}
-/**
-* 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
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -431,21 +459,19 @@ public String getItem (int index) {
OS.XtFree (address);
return new String (Converter.mbcsToWcs (null, buffer));
}
-/**
-* 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
-*/
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -453,21 +479,20 @@ public int getItemCount () {
OS.XtGetValues (handle, argList, argList.length / 2);
return argList [1];
}
-/**
-* 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
-*/
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -481,21 +506,26 @@ public int getItemHeight () {
/* Result is from empirical analysis on Linux and AIX */
return getFontHeight () + spacing + highlight + 1;
}
-/**
-* 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
-*/
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -525,23 +555,26 @@ public String [] getItems () {
}
return result;
}
-/**
-* 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(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
-* @exception SWTError(ERROR_CANNOT_GET_SELECTION)
-* when the operation fails
-*/
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -571,21 +604,19 @@ public String [] getSelection () {
}
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(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
-*/
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -593,33 +624,20 @@ public int getSelectionCount () {
OS.XtGetValues (handle, argList, argList.length / 2);
return argList [1];
}
-/**
-* Gets the index of the selected item.
-* <p>
-* Indexing is zero based.
-*
-* When the list is single-select, the index of
-* the selected item is returned or -1 if no item
-* is selected.
-*
-* When the list is multi-select, the index of
-* a selected item that contains the focus
-* rectangle or the index of the first selected
-* item is return. If no item is selected, -1
-* is returned.
-*
-* This operation will fail if the selected
-* index cannot be queried from the OS.
-*
-* @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
-* @exception SWTError(ERROR_CANNOT_GET_SELECTION)
-* when the operation fails
-*/
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -634,25 +652,24 @@ public int getSelectionIndex () {
OS.XtFree (address);
return indices [0] - 1;
}
-/**
-* Gets the indices of the selected items.
-* <p>
-* Indexing is zero based.
-*
-* If no item is selected, an array is returned.
-*
-* This operation will fail if the selected
-* indices cannot be queried from the OS.
-*
-* @return the indices of the selected 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_CANNOT_GET_SELECTION)
-* when the operation fails
-*/
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -664,21 +681,18 @@ public int [] getSelectionIndices () {
for (int i=0; i<result.length; i++) --result [i];
return result;
}
-/**
-* Gets the top index.
-* <p>
-* The top index is the index of the item that
-* is currently at the top of the widget. The
-* top index changes when the widget is scrolled.
-* Indexing is zero based.
-*
-* @return the index of the top item
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -693,24 +707,25 @@ void hookEvents () {
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 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
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -722,25 +737,28 @@ public int indexOf (String string) {
OS.XmStringFree (xmString);
return index - 1;
}
-/**
-* Gets the index of an item.
-* <p>
-* The list is searched starting at and including
-* the start 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
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -764,44 +782,42 @@ public int indexOf (String string, int start) {
if (index == itemCount) return -1;
return index;
}
-/**
-* Determines if an item is selected.
-* <p>
-* Indexing is zero based.
-*
-* @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
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
if (index == -1) return false;
return OS.XmListPosSelected (handle, index + 1);
}
-/**
-* 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
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -819,27 +835,25 @@ public void remove (int index) {
}
OS.XmListDeletePos (handle, index + 1);
}
-/**
-* 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
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -859,23 +873,25 @@ public void remove (int start, int end) {
OS.XmListDeleteItemsPos (handle, count, start + 1);
if (end >= argList [1]) error (SWT.ERROR_INVALID_RANGE);
}
-/**
-* 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
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -888,26 +904,23 @@ public void remove (String string) {
if (index == 0) error (SWT.ERROR_INVALID_ARGUMENT);
OS.XmListDeletePos (handle, index);
}
-/**
-* Removes items.
-* <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 indices the indices of the 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 the indices are null
-* @exception SWTError(ERROR_ITEM_NOT_REMOVED)
-* when the operation fails
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -930,19 +943,14 @@ public void remove (int [] indices) {
OS.XmListDeletePositions (handle, newIndices, length);
if (length < indices.length) error (SWT.ERROR_INVALID_RANGE);
}
-/**
-* Removes all items.
-* <p>
-* This operation will fail when an item
-* could not be removed in the OS.
-*
-* @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
-*/
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -958,19 +966,23 @@ public void removeAll () {
*/
if ((style & SWT.H_SCROLL) != 0) OS.XtResizeWindow (handle);
}
-/**
-* 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
-*/
+/**
+ * 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);
@@ -979,21 +991,18 @@ public void removeSelectionListener(SelectionListener listener) {
eventTable.unhook(SWT.Selection, listener);
eventTable.unhook(SWT.DefaultSelection,listener);
}
-/**
-* Selects an item.
-* <p>
-* If the item at an index is not selected, it is
-* selected. If the item at an index is selected,
-* it remains 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
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -1024,26 +1033,20 @@ public void select (int index) {
OS.XtSetValues (handle, argList, argList.length / 2);
}
}
-/**
-* Selects a range of items.
-* <p>
-* If the item at an index is not selected, it is
-* selected. If the item at an index is selected,
-* it remains selected. Indices that are out of
-* range are ignored.
-*
-* Indexing is zero based. The range of items
-* is from the start index up to and including
-* the end index.
-*
-* @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
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -1085,23 +1088,23 @@ public void select (int start, int end) {
OS.XtSetValues (handle, argList, argList.length / 2);
}
}
-/**
-* Selects items.
-* <p>
-* If the item at an index is not selected, it is
-* selected. If the item at an index is selected,
-* it remains selected. Indices that are out of
-* range are ignored. Indexing is zero based.
-*
-* @param indices the indices of the 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 the indices are null
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -1167,17 +1170,14 @@ void select (String [] items) {
OS.XtFree (ptr);
OS.XmListUpdateSelectedList (handle);
}
-/**
-* Selects all items.
-* <p>
-* If an item is not selected, it is selected.
-* If an item is selected, it remains selected.
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -1208,9 +1208,6 @@ public void selectAll () {
OS.XtSetValues (handle, argList, argList.length / 2);
}
}
-/**
-* Sets the bounds.
-*/
public void setBounds (int x, int y, int width, int height) {
super.setBounds (x, y, width, height);
/*
@@ -1248,27 +1245,27 @@ public void setBounds (int x, int y, int width, int height) {
void setFocusIndex (int index) {
OS.XmListSetKbdItemPos (handle, index + 1);
}
-/**
-* 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
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -1287,26 +1284,19 @@ public void setItem (int index, String string) {
if (isSelected) OS.XmListSelectPos (handle, index + 1, false);
OS.XmStringFree (xmString);
}
-/**
-* 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(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
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -1351,85 +1341,83 @@ public void setItems (String [] items) {
}
if (index < items.length) error (SWT.ERROR_ITEM_NOT_ADDED);
}
-/**
-* Sets the selection.
-* <p>
-* The previous selection is cleared
-* before new items are selected.
-*
-* @see List#deselectAll()
-* @see List#select(int)
-*
-* @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
-*/
+/**
+ * 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);
}
-/**
-* Sets the selection.
-* <p>
-* The previous selection is cleared
-* before new items are selected.
-*
-* @see List#deselectAll()
-* @see List#select(int, int)
-*
-* @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
-*/
+/**
+ * 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);
}
-/**
-* Sets the selection.
-* <p>
-* The previous selection is cleared
-* before new items are selected.
-*
-* @see List#deselectAll()
-* @see List#select(int [])
-*
-* @param indices the indices of the items
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * Selects the items at the given zero-relative indices in the receiver.
+ * The current selected of 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 selection.
-* <p>
-* The previous selection is cleared
-* before new items are selected.
-*
-* @see List#deselectAll()
-* @see List#select(int [])
-*
-* @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
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -1470,9 +1458,6 @@ public void setSelection (String [] items) {
OS.XtFree (ptr);
OS.XmListUpdateSelectedList (handle);
}
-/**
-* Sets the size.
-*/
public void setSize (int width, int height) {
super.setSize (width, height);
/*
@@ -1507,21 +1492,18 @@ public void setSize (int width, int height) {
OS.XtResizeWidget (scrolledHandle, argList [1] + 1, argList [3], argList [5]);
OS.XtResizeWidget (scrolledHandle, argList [1], argList [3], argList [5]);
}
-/**
-* Sets the top index.
-* <p>
-* The top index is the index of the item that
-* is currently at the top of the widget. The
-* top index changes when the widget is scrolled.
-* Indexing starts from zero.
-*
-* @param index the new top index
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -1532,20 +1514,19 @@ public void setTopIndex (int index) {
if (newIndex > lastIndex) newIndex = lastIndex;
OS.XmListSetPos (handle, newIndex);
}
-/**
-* 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(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
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
index 31a4ce5f15..38ef27e42f 100755
--- 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
@@ -1,25 +1,27 @@
package org.eclipse.swt.widgets;
/*
-* Licensed Materials - Property of IBM,
-* SWT - The Simple Widget Toolkit,
-* (c) Copyright IBM Corp 1998, 1999.
-*/
-
-/* Imports */
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
import org.eclipse.swt.internal.motif.*;
import org.eclipse.swt.*;
import org.eclipse.swt.events.*;
-/**
-* A menu is a user interface object contains selectable
-* menu items.
-* <p>
-* <b>Styles</b><br>
-* <dd>BAR, DROP_DOWN, POP_UP<br>
-*/
-
-/* Class Definition */
+/**
+ * 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 /*final*/ class Menu extends Widget {
boolean hasLocation;
MenuItem cascade, defaultItem;
@@ -50,19 +52,25 @@ public Menu (Menu parentMenu) {
public Menu (MenuItem parentItem) {
this (checkNull(parentItem).parent);
}
-/**
-* 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
-*/
+/**
+ * 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);
@@ -70,19 +78,25 @@ public void addHelpListener (HelpListener listener) {
TypedListener typedListener = new TypedListener (listener);
addListener (SWT.Help, 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
-*/
+/**
+ * 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);
@@ -127,7 +141,8 @@ void createHandle (int index) {
/* BAR menu */
if ((style & SWT.BAR) != 0) {
int parentHandle = parent.scrolledHandle;
- handle = OS.XmCreateMenuBar (parentHandle, null, null, 0);
+ int [] argList = {OS.XmNancestorSensitive, 1};
+ handle = OS.XmCreateMenuBar (parentHandle, null, argList, argList.length / 2);
if (handle == 0) error (SWT.ERROR_NO_HANDLES);
return;
}
@@ -147,7 +162,8 @@ void createHandle (int index) {
*/
if ((style & SWT.POP_UP) != 0) {
int parentHandle = parent.dialogHandle ();
- handle = OS.XmCreatePopupMenu (parentHandle, new byte [1], null, 0);
+ int [] argList = {OS.XmNancestorSensitive, 1};
+ handle = OS.XmCreatePopupMenu (parentHandle, new byte [1], argList, argList.length / 2);
} else {
/*
* Bug in Linux. For some reason, when the parent of the pulldown
@@ -156,7 +172,8 @@ void createHandle (int index) {
* that the parent is the main window.
*/
int parentHandle = parent.scrolledHandle;
- handle = OS.XmCreatePulldownMenu (parentHandle, new byte [1], null, 0);
+ int [] argList = {OS.XmNancestorSensitive, 1};
+ handle = OS.XmCreatePulldownMenu (parentHandle, new byte [1], argList, argList.length / 2);
}
if (handle == 0) error (SWT.ERROR_NO_HANDLES);
@@ -173,40 +190,41 @@ void createWidget (int index) {
super.createWidget (index);
parent.add (this);
}
-/**
-* Gets the default item.
-* <p>
-*
-* @return the default menu item.
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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 defaultItem;
}
-/**
-* Gets the Display.
-*/
public Display getDisplay () {
Decorations parent = this.parent;
if (parent == null) error (SWT.ERROR_WIDGET_DISPOSED);
return parent.getDisplay ();
}
-/**
-* Gets the enabled state.
-* <p>
-* @return the enabled flag
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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);
@@ -214,25 +232,21 @@ public boolean getEnabled () {
OS.XtGetValues (handle, argList, argList.length / 2);
return argList [1] != 0;
}
-/**
-* 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
-*/
+/**
+ * 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);
@@ -254,16 +268,16 @@ public MenuItem getItem (int index) {
if (!(widget instanceof MenuItem)) error (SWT.ERROR_CANNOT_GET_ITEM);
return (MenuItem) widget;
}
-/**
-* Gets the number of items.
-* <p>
-* @return the number 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
-*/
+/**
+ * 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);
@@ -278,16 +292,22 @@ public int getItemCount () {
}
return count;
}
-/**
-* Gets the items.
-* <p>
-* @return items
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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);
@@ -321,82 +341,93 @@ String getNameText () {
}
return result;
}
-/**
-* Gets the parent.
-* <p>
-* @return the parent
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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;
}
-/**
-* Gets the parent item.
-* <p>
-* @return the parent item
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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;
}
-/**
-* Gets the parent menu.
-* <p>
-* @return the parent menu
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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 cascade.parent;
return null;
}
-/**
-* Gets the shell.
-* <p>
-* @return the shell
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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 ();
}
-/**
-* Gets the visibility state.
-* <p>
-* If the parent is not visible or some other condition
-* makes the widget not visible, the widget can still be
-* considered visible even though it may not actually be
-* showing.
-*
-* @return visible the visibility state
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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);
@@ -408,24 +439,23 @@ void hookEvents () {
OS.XtAddCallback (handle, OS.XmNmapCallback, windowProc, SWT.Show);
OS.XtAddCallback (handle, OS.XmNunmapCallback, windowProc, SWT.Hide);
}
-/**
-* 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 item 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
-*/
+/**
+ * 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);
@@ -442,6 +472,19 @@ public int indexOf (MenuItem item) {
}
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);
@@ -449,21 +492,23 @@ public boolean isEnabled () {
if (parentMenu == null) return getEnabled ();
return getEnabled () && parentMenu.isEnabled ();
}
-/**
-* Gets the visibility status.
-* <p>
-* This method returns the visibility status of the
-* widget in the widget hierarchy. If the parent is not
-* visible or some other condition makes the widget not
-* visible, this method will return false.
-*
-* @return the actual visibility state
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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);
@@ -519,19 +564,23 @@ void releaseWidget () {
parent = null;
cascade = defaultItem = null;
}
-/**
-* 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
-*/
+/**
+ * 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);
@@ -539,19 +588,23 @@ public void removeHelpListener (HelpListener listener) {
if (eventTable == null) return;
eventTable.unhook (SWT.Help, 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
-*/
+/**
+ * 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);
@@ -567,37 +620,57 @@ void sendHelpEvent (int callData) {
}
parent.sendHelpEvent (callData);
}
-/**
-* Sets the default item.
-* <p>
-* @param item the default menu item (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
-*/
+/**
+ * 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 SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the 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);
defaultItem = item;
}
-/**
-* Sets the enabled state.
-* <p>
-* @param enabled the new value of the enabled flag
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been 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);
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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -606,21 +679,22 @@ public void setLocation (int x, int y) {
OS.XtSetValues (handle, argList, argList.length / 2);
hasLocation = true;
}
-/**
-* Sets the visibility state.
-* <p>
-* If the parent is not visible or some other condition
-* makes the widget not visible, the widget can still be
-* considered visible even though it may not actually be
-* showing.
-*
-* @param visible the new visibility state
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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);
@@ -637,6 +711,18 @@ public void setVisible (boolean visible) {
xDisplay, xWindow, unused, unused,
rootX, rootY,
unused, unused, unused) == 0) return;
+
+ /* Bug in Motif:
+ * You *must* start outside the menu or it will not show you
+ * highlighting until you move the cursor out of and back into
+ * the menu. By offsetting the start location by a pixel, it
+ * causes highlighting to work if you wait for the menu to
+ * pop up before you start moving.(Except for the bottom
+ * right corner.)
+ */
+ rootX[0] += 1;
+ rootY[0] += 1;
+
int [] argList = {OS.XmNx, rootX [0], OS.XmNy, rootY [0]};
OS.XtSetValues (handle, argList, argList.length / 2);
}
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
index 23ff61753d..92404313c1 100755
--- 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
@@ -1,30 +1,29 @@
package org.eclipse.swt.widgets;
/*
-* Licensed Materials - Property of IBM,
-* SWT - The Simple Widget Toolkit,
-* (c) Copyright IBM Corp 1998, 1999.
-*/
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
-/* Imports */
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.*;
-/**
-* A menu item is a selectable user interface object
-* that issues notificiation when pressed and released.
-*
-* <p>
-* <b>Styles</b><br>
-* <dd>CASCADE, CHECK, PUSH, RADIO, SEPARATOR<br>
-* <b>Events</b><br>
-* <dd>Selection<br>
-*/
-
-/* Class Definition */
+/**
+ * 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 /*final*/ class MenuItem extends Item {
int accelerator;
Menu parent, menu;
@@ -45,19 +44,25 @@ public MenuItem (Menu parent, int style, int index) {
if (index == OS.XmLAST_POSITION) error (SWT.ERROR_INVALID_RANGE);
createWidget (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
-*/
+/**
+ * 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);
@@ -65,19 +70,25 @@ public void addArmListener (ArmListener listener) {
TypedListener typedListener = new TypedListener (listener);
addListener (SWT.Arm, 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
-*/
+/**
+ * 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);
@@ -85,19 +96,30 @@ public void addHelpListener (HelpListener listener) {
TypedListener typedListener = new TypedListener (listener);
addListener (SWT.Help, 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
-*/
+/**
+ * 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);
@@ -133,6 +155,7 @@ void createHandle (int index) {
}
if ((style & SWT.SEPARATOR) != 0) {
int [] argList = {
+ OS.XmNancestorSensitive, 1,
OS.XmNorientation, (parent.style & SWT.BAR) != 0 ? OS.XmVERTICAL : OS.XmHORIZONTAL,
OS.XmNpositionIndex, index,
};
@@ -140,7 +163,10 @@ void createHandle (int index) {
if (handle == 0) error (SWT.ERROR_NO_HANDLES);
return;
}
- int [] argList = {OS.XmNpositionIndex, index};
+ 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);
@@ -168,49 +194,42 @@ void destroyWidget () {
OS.XtUnmanageChild (handle);
super.destroyWidget ();
}
-/**
-* Gets the accelerator.
-* <p>
-* This method gets the widget accelerator. An accelerator
-* is the bit-wise OR of zero or more modifier masks and a key.
-* Examples: SWT.CONTROL | SWT.SHIFT | 'T', SWT.ALT | SWT.F2.
-*
-* @param accelerator the accelerator
-*
-* @return the accelerator
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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;
}
-/**
-* Gets the Display.
-*/
public Display getDisplay () {
Menu parent = this.parent;
if (parent == null) error (SWT.ERROR_WIDGET_DISPOSED);
return parent.getDisplay ();
}
-/**
-* Gets the enabled state.
-* <p>
-* A disabled widget is typically not selectable from
-* the user interface and draws with an inactive or
-* grayed look.
-*
-* @return a boolean that is the enabled state of 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
-*/
+/**
+ * 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);
@@ -218,23 +237,20 @@ public boolean getEnabled () {
OS.XtGetValues (handle, argList, argList.length / 2);
return argList [1] != 0;
}
-/**
-* Gets the menu.
-* <p>
-* For a cascade menu item, the menu is a pulldown menu
-* that is displayed when the user selects the cascade item.
-* For a window, the menu is always a popup menu, that is
-* displayed when the user requests a popup menu for the
-* window. The sequence of key strokes or button presses
-* that requests a menu is platform specific.
-*
-* @return the menu
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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);
@@ -244,36 +260,35 @@ String getNameText () {
if ((style & SWT.SEPARATOR) != 0) return "|";
return super.getNameText ();
}
-/**
-* Gets the parent.
-* <p>
-* @return the parent
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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;
}
-/**
-* Gets the selection state.
-* <p>
-* This method gets the widget selection state for a
-* widgets with the style CHECK or RADIO. It
-* returns false for widgets that do not have one of
-* these styles.
-* true or false - for CHECK or RADIO.
-* false - for all other widget styles
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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);
@@ -283,26 +298,19 @@ public boolean getSelection () {
return argList [1] != 0;
}
/**
-* Get the button text.
-*
-* RETURNS
-*
-* A String that is the label of the button.
-*
-* REMARKS
-*
-* This method returns the button label. The label may
+* Returns the button label. The label may
* include the mnemonic character but must not contain line
* delimiters.
-*
-**/
+*/
String getText2 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
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], mnemonic = argList [3], xmString2 = argList [5];
+ 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 (
@@ -376,22 +384,19 @@ void hookEvents () {
OS.XtAddCallback (handle, OS.XmNactivateCallback, windowProc, SWT.Selection);
}
}
-/**
-* Gets the enabled state.
-* <p>
-* This method gets the enabled state of the widget
-* in the widget hierarchy. When an ancestor of the
-* widget is disabled, the enabled state of the widget
-* in the widget hierarchy is disabled regardless of
-* the actual enabled state of the widget.
-*
-* @param enabled a boolean that is the enabled state.
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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 ();
}
@@ -429,8 +434,28 @@ int processHelp (int callData) {
parent.sendHelpEvent (callData);
return 0;
}
-int processSelection (int callData) {
- postEvent (SWT.Selection);
+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:
+ 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;
+ }
+ }
+ postEvent (SWT.Selection, event);
return 0;
}
void releaseChild () {
@@ -451,19 +476,23 @@ void releaseWidget () {
}
parent = null;
}
-/**
-* 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
-*/
+/**
+ * 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);
@@ -471,19 +500,23 @@ public void removeArmListener (ArmListener listener) {
if (eventTable == null) return;
eventTable.unhook (SWT.Arm, 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
-*/
+/**
+ * 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);
@@ -491,19 +524,23 @@ public void removeHelpListener (HelpListener listener) {
if (eventTable == null) return;
eventTable.unhook (SWT.Help, 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
-*/
+/**
+ * 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);
@@ -512,9 +549,19 @@ public void removeSelectionListener(SelectionListener listener) {
eventTable.unhook(SWT.Selection, listener);
eventTable.unhook(SWT.DefaultSelection,listener);
}
-/**
-* Sets the accelerator.
-*/
+/**
+ * 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);
@@ -542,43 +589,44 @@ public void setAccelerator (int accelerator) {
OS.XtSetValues (handle, argList, argList.length / 2);
if (ptr != 0) OS.XtFree (ptr);
}
-/**
-* 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 value of the enabled flag
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been 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);
int [] argList = {OS.XmNsensitive, enabled ? 1 : 0};
OS.XtSetValues (handle, argList, argList.length / 2);
}
-/**
-* Sets the menu.
-* <p>
-* For a cascade menu item, the menu is a pulldown menu
-* that is displayed when the user selects the cascade item.
-* For a window, the menu is always a popup menu, that is
-* displayed when the user requests a popup menu for the
-* window. The sequence of key strokes or button presses
-* that requests a menu is platform specific.
-*
-* @param menu the menu
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * Sets the receiver's cascade 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 pop up menu
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_MENU_NOT_DROP_DOWN - the menu is not a drop down menu</li>
+ * <li>ERROR_MENUITEM_NOT_CASCADE - the menu item is not a <code>CASCADE</code></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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -611,21 +659,19 @@ public void setMenu (Menu menu) {
int [] argList = {OS.XmNsubMenuId, menuHandle};
OS.XtSetValues (handle, argList, argList.length / 2);
}
-/**
-* Sets the selection state.
-* <p>
-* This method sets the widget selection state for a
-* widgets with the style CHECK or RADIO. It
-* returns false for widgets that do not have one of
-* these styles.
-*
-* @param selected the new 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
-*/
+/**
+ * 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);
@@ -691,7 +737,8 @@ public void setText (String string) {
null,
0,
0);
- if (xmString1 == 0) error (SWT.ERROR_CANNOT_SET_TEXT);
+ 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,
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
index 2f06dd4927..f1980dae5b 100755
--- 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
@@ -1,31 +1,32 @@
package org.eclipse.swt.widgets;
/*
-* Licensed Materials - Property of IBM,
-* SWT - The Simple Widget Toolkit,
-* (c) Copyright IBM Corp 1998, 1999.
-*/
-
-/**
-* A message box is used to inform or warn the
-* the user that a particular situation has occurred.
-*
-* Styles
-*
-* ICON_ERROR, ICON_INFORMATION, ICON_QUESTION, ICON_WARNING, ICON_WORKING,
-* OK, OK_CANCEL, YES_NO, YES_NO_CANCEL
-*
-* Events
-*
-**/
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
-/* Imports */
import org.eclipse.swt.internal.*;
import org.eclipse.swt.internal.motif.*;
import org.eclipse.swt.*;
import org.eclipse.swt.widgets.*;
-/* Class Definition */
+/**
+ * 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 /*final*/ class MessageBox extends Dialog {
int button;
String message = "";
@@ -177,7 +178,7 @@ void setButtons (int dialogHandle) {
}
if ((style & (SWT.YES | SWT.NO | SWT.CANCEL)) == (SWT.YES | SWT.NO | SWT.CANCEL)) {
OS.XtManageChild (help);
- byte [] buffer1 = Converter.wcsToMbcs (null, "Yes", true);
+ byte [] buffer1 = Converter.wcsToMbcs (null, SWT.getMessage("SWT_Yes"), true);
int xmString1 = OS.XmStringParseText (
buffer1,
0,
@@ -186,7 +187,7 @@ void setButtons (int dialogHandle) {
null,
0,
0);
- byte [] buffer2 = Converter.wcsToMbcs (null, "No", true);
+ byte [] buffer2 = Converter.wcsToMbcs (null, SWT.getMessage("SWT_No"), true);
int xmString2 = OS.XmStringParseText (
buffer2,
0,
@@ -195,7 +196,7 @@ void setButtons (int dialogHandle) {
null,
0,
0);
- byte [] buffer3 = Converter.wcsToMbcs (null, "Cancel", true);
+ byte [] buffer3 = Converter.wcsToMbcs (null, SWT.getMessage("SWT_Cancel"), true);
int xmString3 = OS.XmStringParseText (
buffer3,
0,
@@ -210,7 +211,7 @@ void setButtons (int dialogHandle) {
return;
}
if ((style & (SWT.YES | SWT.NO)) == (SWT.YES | SWT.NO)) {
- byte [] buffer1 = Converter.wcsToMbcs (null, "Yes", true);
+ byte [] buffer1 = Converter.wcsToMbcs (null, SWT.getMessage("SWT_Yes"), true);
int xmString1 = OS.XmStringParseText (
buffer1,
0,
@@ -219,7 +220,7 @@ void setButtons (int dialogHandle) {
null,
0,
0);
- byte [] buffer2 = Converter.wcsToMbcs (null, "No", true);
+ byte [] buffer2 = Converter.wcsToMbcs (null, SWT.getMessage("SWT_No"), true);
int xmString2 = OS.XmStringParseText (
buffer2,
0,
@@ -234,7 +235,7 @@ void setButtons (int dialogHandle) {
return;
}
if ((style & (SWT.RETRY | SWT.CANCEL)) == (SWT.RETRY | SWT.CANCEL)) {
- byte [] buffer1 = Converter.wcsToMbcs (null, "Retry", true);
+ byte [] buffer1 = Converter.wcsToMbcs (null, SWT.getMessage("SWT_Retry"), true);
int xmString1 = OS.XmStringParseText (
buffer1,
0,
@@ -243,7 +244,7 @@ void setButtons (int dialogHandle) {
null,
0,
0);
- byte [] buffer2 = Converter.wcsToMbcs (null, "Cancel", true);
+ byte [] buffer2 = Converter.wcsToMbcs (null, SWT.getMessage("SWT_Cancel"), true);
int xmString2 = OS.XmStringParseText (
buffer2,
0,
@@ -259,7 +260,7 @@ void setButtons (int dialogHandle) {
}
if ((style & (SWT.ABORT | SWT.RETRY | SWT.IGNORE)) == (SWT.ABORT | SWT.RETRY | SWT.IGNORE)) {
OS.XtManageChild (help);
- byte [] buffer1 = Converter.wcsToMbcs (null, "Abort", true);
+ byte [] buffer1 = Converter.wcsToMbcs (null, SWT.getMessage("SWT_Abort"), true);
int xmString1 = OS.XmStringParseText (
buffer1,
0,
@@ -268,7 +269,7 @@ void setButtons (int dialogHandle) {
null,
0,
0);
- byte [] buffer2 = Converter.wcsToMbcs (null, "Retry", true);
+ byte [] buffer2 = Converter.wcsToMbcs (null, SWT.getMessage("SWT_Retry"), true);
int xmString2 = OS.XmStringParseText (
buffer2,
0,
@@ -277,7 +278,7 @@ void setButtons (int dialogHandle) {
null,
0,
0);
- byte [] buffer3 = Converter.wcsToMbcs (null, "Ignore", true);
+ byte [] buffer3 = Converter.wcsToMbcs (null, SWT.getMessage("SWT_Ignore"), true);
int xmString3 = OS.XmStringParseText (
buffer3,
0,
@@ -296,8 +297,16 @@ void setMessage (int dialogHandle) {
String text = message;
int label = OS.XmMessageBoxGetChild (dialogHandle, OS.XmDIALOG_MESSAGE_LABEL);
if (label != 0) {
-// (fontList := OSWidget resourceAt: XmNfontList handle: widget) == 0 ifFalse: [
-// text := OSWidget wrapText: message font: fontList width: DisplayWidth * 3 // 5]].
+ 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);
+ }
}
byte [] buffer = Converter.wcsToMbcs (null, text, true);
int [] parseTable = Display.getDefault ().parseTable;
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
index eb1a6cdbec..c2d580ae8b 100755
--- 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
@@ -1,25 +1,30 @@
package org.eclipse.swt.widgets;
/*
-* Licensed Materials - Property of IBM,
-* SWT - The Simple Widget Toolkit,
-* (c) Copyright IBM Corp 1998, 1999.
-*/
-
-/* Imports */
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
import org.eclipse.swt.internal.motif.*;
import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
-/**
-* A progress bar is an unselectable user interface object
-* that is used to display progress in the form of a bar graph.
-*
-* <b>Styles</b><br>
-* <dd>HORIZONTAL, VERTICAL<br>
-*/
+/**
+ * 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>
+ */
-/* Class Definition */
public /*final*/ class ProgressBar extends Control {
/**
* Creates a new instance of the widget.
@@ -39,9 +44,6 @@ public ProgressBar (Composite parent, int style) {
static int checkStyle (int style) {
return checkBits (style, SWT.HORIZONTAL, SWT.VERTICAL, 0, 0, 0, 0);
}
-/**
-* Computes the preferred size.
-*/
public Point computeSize (int wHint, int hHint, boolean changed) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -63,32 +65,48 @@ public Point computeSize (int wHint, int hHint, boolean changed) {
}
void createHandle (int index) {
state |= HANDLE;
- int backgroundPixel = defaultBackground ();
- int [] argList1 = {
+ int background = defaultBackground ();
+ int parentHandle = parent.handle;
+ int [] argList = {
OS.XmNshowArrows, 0,
OS.XmNsliderSize, 1,
OS.XmNtraversalOn, 0,
- OS.XmNtroughColor, backgroundPixel,
- OS.XmNtopShadowColor, backgroundPixel,
- OS.XmNbottomShadowColor, backgroundPixel,
+ 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 (parent.handle, null, argList1, argList1.length / 2);
+ 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);
}
-/**
-* Gets the maximum.
-* <p>
-* @return maximum
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -96,16 +114,16 @@ public int getMaximum () {
OS.XtGetValues (handle, argList, argList.length / 2);
return argList [1];
}
-/**
-* Gets the minimum.
-* <p>
-* @return minimum
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -113,16 +131,16 @@ public int getMinimum () {
OS.XtGetValues (handle, argList, argList.length / 2);
return argList [1];
}
-/**
-* Gets the selection.
-* <p>
-* @return the selection
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -132,33 +150,37 @@ public int getSelection () {
OS.XmNbackground, 0,
};
OS.XtGetValues (handle, argList, argList.length / 2);
- int minimum = argList [1];
- int sliderSize = argList [3];
- int backGround = argList [5];
- if (sliderSize == 1 && backGround == defaultBackground()) sliderSize = 0;
+ 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. Also, when enabled
+ */
+ if (enabled) {
+ disableTraversal ();
+ disableButtonPress ();
+ }
}
void realizeChildren () {
- super.realizeChildren ();
- 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);
+ super.realizeChildren ();
+ disableButtonPress ();
}
-/**
-* Sets the maximum.
-* <p>
-* @param maximum
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -170,16 +192,18 @@ public void setMaximum (int value) {
OS.XtSetValues (handle, argList, argList.length / 2);
display.setWarnings (warnings);
}
-/**
-* Sets the minimum
-* <p>
-* @param minimum
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -207,16 +231,18 @@ public void setMinimum (int value) {
display.setWarnings (warnings);
setThumb(selection - value);
}
-/**
-* Sets the selection.
-* <p>
-* @param value 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
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
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
index 66fcca5ba0..7ca606ca88 100755
--- 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
@@ -1,51 +1,91 @@
package org.eclipse.swt.widgets;
/*
-* Licensed Materials - Property of IBM,
-* SWT - The Simple Widget Toolkit,
-* (c) Copyright IBM Corp 1998, 1999.
-*/
-
-/* Imports */
+ * (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.*;
-/**
-* A sash is a selectable user interface object
-* that allows the user to drag a rubber banded
-* outline of the sash within the parent window.
-*
-* <p>
-* <b>Styles</b><br>
-* <dd>HORIZONTAL,VERTICAL<br>
-*/
+/**
+ * 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>
+ */
-/* Class Definition */
public /*final*/ class Sash extends Control {
boolean dragging;
int startX, startY, lastX, lastY;
int cursor;
/**
-* Creates a new instance of the 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 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 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
-*/
+/**
+ * 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);
@@ -57,9 +97,6 @@ public void addSelectionListener(SelectionListener listener) {
static int checkStyle (int style) {
return checkBits (style, SWT.HORIZONTAL, SWT.VERTICAL, 0, 0, 0, 0);
}
-/**
-* Computes the preferred size.
-*/
public Point computeSize (int wHint, int hHint, boolean changed) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -82,8 +119,10 @@ void createHandle (int index) {
OS.XmNmarginWidth, 0,
OS.XmNmarginHeight, 0,
OS.XmNresizePolicy, OS.XmRESIZE_NONE,
+ OS.XmNancestorSensitive, 1,
};
- handle = OS.XmCreateDrawingArea (parent.handle, null, argList, argList.length / 2);
+ 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);
@@ -203,19 +242,23 @@ void releaseWidget () {
}
cursor = 0;
}
-/**
-* 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
-*/
+/**
+ * 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);
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
index 583ba89eba..8fae896a6b 100755
--- 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
@@ -1,50 +1,82 @@
package org.eclipse.swt.widgets;
/*
-* Licensed Materials - Property of IBM,
-* SWT - The Simple Widget Toolkit,
-* (c) Copyright IBM Corp 1998, 1999.
-*/
-
-/* Imports */
+ * (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.*;
-/**
-* A scale is a selectable user interface object
-* that represents a range of continuous numeric values.
-*
-* <p>
-* <b>Styles</b><br>
-* <dd>HORIZONTAL,VERTICAL<br>
-* <br>
-* <b>Events</b><br>
-* <dd>Selection<br
-*/
+/**
+ * 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>
+ */
-/* Class Definition */
public /*final*/ class Scale extends Control {
/**
-* Creates a new instance of the 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 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 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
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -56,9 +88,6 @@ public void addSelectionListener(SelectionListener listener) {
static int checkStyle (int style) {
return checkBits (style, SWT.HORIZONTAL, SWT.VERTICAL, 0, 0, 0, 0);
}
-/**
-* Computes the preferred size.
-*/
public Point computeSize (int wHint, int hHint, boolean changed) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -85,35 +114,39 @@ void createHandle (int index) {
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,
};
- handle = OS.XmCreateScale (parent.handle, null, argList, argList.length / 2);
+ int parentHandle = parent.handle;
+ handle = OS.XmCreateScale (parentHandle, null, argList, argList.length / 2);
if (handle == 0) error (SWT.ERROR_NO_HANDLES);
}
-/**
-* Gets the increment.
-* <p>
-* @return the increment
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
return 1;
}
-/**
-* Gets the maximum.
-* <p>
-* @return the maximum
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -121,16 +154,16 @@ public int getMaximum () {
OS.XtGetValues (handle, argList, argList.length / 2);
return argList [1];
}
-/**
-* Gets the minimum.
-* <p>
-* @return the minimum
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -138,16 +171,18 @@ public int getMinimum () {
OS.XtGetValues (handle, argList, argList.length / 2);
return argList [1];
}
-/**
-* Gets the page increment.
-* <p>
-* @return the page increment
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -155,16 +190,16 @@ public int getPageIncrement () {
OS.XtGetValues (handle, argList, argList.length / 2);
return argList [1];
}
-/**
-* Gets the selection.
-* <p>
-* @return the selection
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -178,19 +213,23 @@ void hookEvents () {
OS.XtAddCallback (handle, OS.XmNvalueChangedCallback, windowProc, SWT.Selection);
OS.XtAddCallback (handle, OS.XmNdragCallback, windowProc, SWT.Selection);
}
-/**
-* 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
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -199,30 +238,35 @@ public void removeSelectionListener(SelectionListener listener) {
eventTable.unhook(SWT.Selection, listener);
eventTable.unhook(SWT.DefaultSelection,listener);
}
-/**
-* Sets the increment value.
-* <p>
-* @param increment the new increment value
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
}
-/**
-* Sets the maximum.
-* <p>
-* @param maximum the new maximum
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -234,16 +278,18 @@ public void setMaximum (int value) {
OS.XtSetValues (handle, argList, argList.length / 2);
display.setWarnings (warnings);
}
-/**
-* Sets the minimum.
-* <p>
-* @param minimum the new minimum
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -255,16 +301,19 @@ public void setMinimum (int value) {
OS.XtSetValues (handle, argList, argList.length / 2);
display.setWarnings (warnings);
}
-/**
-* Sets the page increment.
-* <p>
-* @param pageIncrement the new page increment
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -276,16 +325,18 @@ public void setPageIncrement (int pageIncrement) {
OS.XtSetValues (handle, argList, argList.length / 2);
display.setWarnings (warnings);
}
-/**
-* Sets the selection.
-* <p>
-* @param selection 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
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
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
index 1ef0f41558..0dfc32c3e9 100755
--- 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
@@ -1,32 +1,76 @@
package org.eclipse.swt.widgets;
/*
-* Licensed Materials - Property of IBM,
-* SWT - The Simple Widget Toolkit,
-* (c) Copyright IBM Corp 1998, 1999.
-*/
-
-/* Imports */
+ * (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.*;
-/**
-* A scroll bar is a selectable user interface object
-* that represents a range of continuous numeric values.
-* Typically these values are used to represent lines of
-* text in a list or text widget.
-*
-* <p>
-* <b>Styles</b><br>
-* <dd>HORIZONTAL, VERTICAL<br>
-* <br>
-* <b>Events</b><br>
-* <dd>Selection<br>
-*/
+/**
+ * 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
+ */
-/* Class Definition */
public /*final*/ class ScrollBar extends Widget {
Scrollable parent;
ScrollBar () {
@@ -37,19 +81,38 @@ ScrollBar (Scrollable parent, int style) {
this.parent = parent;
createWidget (0);
}
-/**
-* 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
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -64,10 +127,12 @@ static int checkStyle (int style) {
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,
};
- handle = OS.XmCreateScrollBar (parent.scrolledHandle, null, argList, argList.length / 2);
+ int parentHandle = parent.scrolledHandle;
+ handle = OS.XmCreateScrollBar (parentHandle, null, argList, argList.length / 2);
if (handle == 0) error (SWT.ERROR_NO_HANDLES);
}
/**
@@ -78,16 +143,19 @@ public Display getDisplay () {
if (parent == null) error (SWT.ERROR_WIDGET_DISPOSED);
return parent.getDisplay ();
}
-/**
-* Gets the enabled state.
-* <p>
-* @return the enabled flag
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -95,16 +163,18 @@ public boolean getEnabled () {
OS.XtGetValues (handle, argList, argList.length / 2);
return argList [1] != 0;
}
-/**
-* Gets the increment.
-* <p>
-* @return the increment
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -112,16 +182,16 @@ public int getIncrement () {
OS.XtGetValues (handle, argList, argList.length / 2);
return argList [1];
}
-/**
-* Gets the maximum.
-* <p>
-* @return the maximum
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -129,16 +199,16 @@ public int getMaximum () {
OS.XtGetValues (handle, argList, argList.length / 2);
return argList [1];
}
-/**
-* Gets the minimum.
-* <p>
-* @return the minimum
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -146,16 +216,18 @@ public int getMinimum () {
OS.XtGetValues (handle, argList, argList.length / 2);
return argList [1];
}
-/**
-* Gets the page increment.
-* <p>
-* @return the page increment
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -163,31 +235,31 @@ public int getPageIncrement () {
OS.XtGetValues (handle, argList, argList.length / 2);
return argList [1];
}
-/**
-* Gets the parent.
-* <p>
-* @return the parent
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
return parent;
}
-/**
-* Gets the selection.
-* <p>
-* @return the selection
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -195,16 +267,18 @@ public int getSelection () {
OS.XtGetValues (handle, argList, argList.length / 2);
return argList [1];
}
-/**
-* Gets the scroll bar size.
-* <p>
-* @return the scroll bar size
-*
-* @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>
-*/
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -213,16 +287,19 @@ public Point getSize () {
int borders = argList [5] * 2;
return new Point (argList [1] + borders, argList [3] + borders);
}
-/**
-* Gets the thumb.
-* <p>
-* @return the thumb value
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -230,21 +307,23 @@ public int getThumb () {
OS.XtGetValues (handle, argList, argList.length / 2);
return argList [1];
}
-/**
-* Gets the visibility state.
-* <p>
-* If the parent is not visible or some other condition
-* makes the widget not visible, the widget can still be
-* considered visible even though it may not actually be
-* showing.
-*
-* @return visible the visibility state
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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);
@@ -261,26 +340,46 @@ void hookEvents () {
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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
return getEnabled () && parent.isEnabled ();
}
-/**
-* Gets the visibility status.
-* <p>
-* This method returns the visibility status of the
-* widget in the widget hierarchy. If the parent is not
-* visible or some other condition makes the widget not
-* visible, this method will return false.
-*
-* @return the actual visibility state
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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);
@@ -307,6 +406,15 @@ int processSelection (int callData) {
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;
}
@@ -319,19 +427,23 @@ void releaseWidget () {
super.releaseWidget ();
parent = null;
}
-/**
-* 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
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -340,32 +452,38 @@ public void removeSelectionListener(SelectionListener listener) {
eventTable.unhook(SWT.Selection, listener);
eventTable.unhook(SWT.DefaultSelection,listener);
}
-/**
-* Sets the enabled state.
-* <p>
-* @param enabled the new value of the enabled flag
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been 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);
int [] argList = {OS.XmNsensitive, enabled ? 1 : 0};
OS.XtSetValues (handle, argList, argList.length / 2);
}
-/**
-* Sets the increment.
-* <p>
-* @param value the new increment
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -373,16 +491,18 @@ public void setIncrement (int value) {
int [] argList = {OS.XmNincrement, value};
OS.XtSetValues (handle, argList, argList.length / 2);
}
-/**
-* Sets the maximum.
-* <p>
-* @param value the new maximum
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -394,16 +514,18 @@ public void setMaximum (int value) {
OS.XtSetValues (handle, argList, argList.length / 2);
display.setWarnings (warnings);
}
-/**
-* Sets the minimum.
-* <p>
-* @param value the new minimum
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -434,16 +556,19 @@ public void setMinimum (int value) {
OS.XtSetValues (handle, argList, argList.length / 2);
display.setWarnings (warnings);
}
-/**
-* Sets the page increment.
-* <p>
-* @param value the new page increment
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -451,16 +576,18 @@ public void setPageIncrement (int value) {
int [] argList = {OS.XmNpageIncrement, value};
OS.XtSetValues (handle, argList, argList.length / 2);
}
-/**
-* Sets the selection.
-* <p>
-* @param value 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
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -472,16 +599,20 @@ public void setSelection (int selection) {
OS.XtSetValues (handle, argList, argList.length / 2);
display.setWarnings (warnings);
}
-/**
-* Sets the thumb.
-* <p>
-* @param value the new thumb value
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -493,6 +624,27 @@ public void setThumb (int value) {
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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -517,21 +669,22 @@ public void setValues (int selection, int minimum, int maximum, int thumb, int i
OS.XtSetValues (handle, argList, argList.length / 2);
display.setWarnings (warnings);
}
-/**
-* Sets the visibility state.
-* <p>
-* If the parent is not visible or some other condition
-* makes the widget not visible, the widget can still be
-* considered visible even though it may not actually be
-* showing.
-*
-* @param visible the new visibility state
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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);
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
index 7915cca806..e4cebf455b 100755
--- 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
@@ -1,25 +1,88 @@
package org.eclipse.swt.widgets;
/*
-* Licensed Materials - Property of IBM,
-* SWT - The Simple Widget Toolkit,
-* (c) Copyright IBM Corp 1998, 1999.
-*/
-
-/* Imports */
+ * (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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -91,6 +154,20 @@ void enableWidget (boolean enabled) {
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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -98,11 +175,33 @@ public Rectangle getClientArea () {
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 () {
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);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/SelectableItem.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/SelectableItem.java
index 7b590263a7..87acefdaef 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/SelectableItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/SelectableItem.java
@@ -1,13 +1,13 @@
package org.eclipse.swt.widgets;
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
-/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
- */
-
/**
* This class implements common behavior of TreeItem and TableItem.
*/
@@ -26,14 +26,14 @@ abstract class SelectableItem extends Item {
*/
SelectableItem(SelectableItemWidget parent, int style) {
super(parent, style);
- setParent(parent);
- addListener(SWT.Dispose, new Listener() {
- public void handleEvent(Event event) {disposeItem();}});
+ setParent(parent);
}
-/**
- * Subclasses should free resources here
- */
-void disposeItem() {
+public void dispose() {
+ if (!isValidWidget ()) return;
+ super.dispose();
+ doDispose();
+}
+void doDispose() {
setParent(null);
}
/**
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/SelectableItemWidget.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/SelectableItemWidget.java
index 0eda6178f2..384fe03089 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/SelectableItemWidget.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/SelectableItemWidget.java
@@ -1,14 +1,14 @@
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.io.*;
import java.util.*;
-
-/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
- */
/**
* This class is intended for widgets that display data of
@@ -1657,22 +1657,46 @@ void select(SelectableItem 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(SelectableItem item) {
- Event event;
-
+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
}
- event = new Event();
- event.item = item;
- notifyListeners(SWT.Selection, event);
+ 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'.
*/
@@ -2024,4 +2048,4 @@ void toggleSelectionNotify(SelectableItem item) {
selectNotify(item);
}
}
-} \ No newline at end of file
+}
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
index 00c268acf0..e5a3334685 100755
--- 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
@@ -1,71 +1,181 @@
package org.eclipse.swt.widgets;
/*
-* Licensed Materials - Property of IBM,
-* SWT - The Simple Widget Toolkit,
-* (c) Copyright IBM Corp 1998, 1999.
-*/
-
-/**
-* The shell class implements a top level window
-* and dialog windows.
-*
-* Styles
-*
-* ON_TOP
-* DBCS
-*
-* Events
-*
-**/
-
-/* Imports */
+ * (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.*;
-/* Class Definition */
+/**
+ * Instances of this class represent the "windows"
+ * which the desktop or "window manager" is managing.
+ * Instances which 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 which 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>
+ * 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>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>
+ * IMPORTANT: This class is not intended to be subclassed.
+ * </p>
+ *
+ * @see Decorations
+ * @see SWT
+ */
public /*final*/ class Shell extends Decorations {
Display display;
int shellHandle;
boolean reparented, realized;
int oldX, oldY, oldWidth, oldHeight;
Control lastFocus;
-/**
-* Creates a widget.
-*/
+/**
+ * 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);
}
-/**
-* Creates a widget.
-*/
+/**
+ * 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);
}
-/**
-* Creates a widget.
-*/
+/**
+ * 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);
}
-/**
-* Creates a widget.
-* <p>
-* This method creates a top level shell widget on a
-* display using style bits to select a particular look
-* or set of properties.
-*
-* @param display the Display (or null for the default)
-* @param style the bitwise OR'ing of widget styles
-*
-* @exception SWTError(ERROR_ERROR_INVALID_PARENT)
-* when the parent is invalid
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-*/
+/**
+ * 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);
}
@@ -82,15 +192,59 @@ Shell (Display display, Shell parent, int style, int handle) {
this.handle = handle;
createWidget (0);
}
-/**
-* Creates a widget.
-*/
+/**
+ * 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);
}
-/**
-* Creates a 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><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);
}
@@ -109,19 +263,25 @@ public static Shell motif_new (Display display, int handle) {
return new Shell (display, null, SWT.NO_TRIM, handle);
}
-/**
-* 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
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -134,7 +294,9 @@ public void addShellListener(ShellListener listener) {
addListener(SWT.Deiconify,typedListener);
}
void adjustTrim () {
- if ((style & SWT.ON_TOP) != 0) return;
+ if (OS.XtIsSubclass (shellHandle, OS.OverrideShellWidgetClass ())) {
+ return;
+ }
/* Query the trim insets */
int shellWindow = OS.XtWindow (shellHandle);
@@ -213,6 +375,18 @@ void adjustTrim () {
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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -288,6 +462,7 @@ void createHandle (int index) {
int [] argList = {
OS.XmNmwmInputMode, inputMode,
OS.XmNmwmDecorations, decorations,
+ OS.XmNoverrideRedirect, (style & SWT.ON_TOP) != 0 ? 1 : 0,
OS.XmNtitle, ptr,
};
byte [] appClass = display.appClass;
@@ -297,7 +472,9 @@ void createHandle (int index) {
shellHandle = OS.XtAppCreateShell (display.appName, appClass, widgetClass, xDisplay, argList, argList.length / 2);
} else {
int widgetClass = OS.TransientShellWidgetClass ();
- if ((style & SWT.ON_TOP) != 0) widgetClass = OS.OverrideShellWidgetClass ();
+// 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, argList, argList.length / 2);
@@ -345,19 +522,40 @@ void destroyWidget () {
public void dispose () {
/*
+ * Note: It is valid to attempt to dispose a widget
+ * more than once. If this happens, fail silently.
+ */
+ if (!isValidWidget ()) 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.
*/
-// /*
-// * 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;
+
+ /*
+ * 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) {
@@ -384,13 +582,27 @@ public Rectangle getBounds () {
int height = argList [3] + trimHeight + (border * 2);
return new Rectangle (root_x [0], root_y [0], width, height);
}
-/**
-* Gets the Display.
-*/
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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -408,16 +620,17 @@ public Shell getShell () {
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
return this;
}
-/**
-* Get dialogs shells.
-* <p>
-* @return the dialog shells
-*
-* @exception SWTError(ERROR_ERROR_INVALID_PARENT)
-* when the parent is invalid
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-*/
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -473,7 +686,7 @@ void hookEvents () {
super.hookEvents ();
int windowProc = display.windowProc;
OS.XtAddEventHandler (shellHandle, OS.StructureNotifyMask, false, windowProc, SWT.Resize);
- if ((style & SWT.ON_TOP) != 0) return;
+ if (OS.XtIsSubclass (shellHandle, OS.OverrideShellWidgetClass ())) return;
OS.XtAddEventHandler (shellHandle, OS.FocusChangeMask, false, windowProc, SWT.FocusIn);
int [] argList = {OS.XmNdeleteResponse, OS.XmDO_NOTHING};
OS.XtSetValues (shellHandle, argList, argList.length / 2);
@@ -514,6 +727,21 @@ void manageChildren () {
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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -620,19 +848,23 @@ void releaseWidget () {
display = null;
lastFocus = null;
}
-/**
-* 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
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -674,6 +906,22 @@ public void setBounds (int x, int y, int width, int height) {
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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
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
index e72a8c2593..2c78f90966 100755
--- 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
@@ -1,49 +1,124 @@
package org.eclipse.swt.widgets;
/*
-* Licensed Materials - Property of IBM,
-* SWT - The Simple Widget Toolkit,
-* (c) Copyright IBM Corp 1998, 1999.
-*/
-
-/* Imports */
+ * (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.*;
-/**
-* A slider is a selectable user interface object
-* that represents a continuous range of numeric values.
-*
-* <b>Styles</b><br>
-* <dd>HORIZONTAL, VERTICAL<br>
-* <br>
-* <b>Events</b><br>
-* <dd>Selection<br>
-*/
-
-/* Class Definition */
+/**
+ * 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 /*final*/ class Slider extends Control {
/**
-* Creates a new instance of the 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 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 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
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -55,9 +130,6 @@ public void addSelectionListener(SelectionListener listener) {
static int checkStyle (int style) {
return checkBits (style, SWT.HORIZONTAL, SWT.VERTICAL, 0, 0, 0, 0);
}
-/**
-* Computes the preferred size.
-*/
public Point computeSize (int wHint, int hHint, boolean changed) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -80,22 +152,26 @@ public Point computeSize (int wHint, int hHint, boolean changed) {
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,
};
- handle = OS.XmCreateScrollBar (parent.handle, null, argList, argList.length / 2);
+ int parentHandle = parent.handle;
+ handle = OS.XmCreateScrollBar (parentHandle, null, argList, argList.length / 2);
if (handle == 0) error (SWT.ERROR_NO_HANDLES);
}
-/**
-* Gets the increment.
-* <p>
-* @return the increment
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -103,16 +179,16 @@ public int getIncrement () {
OS.XtGetValues (handle, argList, argList.length / 2);
return argList [1];
}
-/**
-* Gets the maximum.
-* <p>
-* @return the maximum
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -120,16 +196,16 @@ public int getMaximum () {
OS.XtGetValues (handle, argList, argList.length / 2);
return argList [1];
}
-/**
-* Gets the minimum.
-* <p>
-* @return the minimum
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -137,16 +213,18 @@ public int getMinimum () {
OS.XtGetValues (handle, argList, argList.length / 2);
return argList [1];
}
-/**
-* Gets the page increment.
-* <p>
-* @return the page increment
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -154,16 +232,16 @@ public int getPageIncrement () {
OS.XtGetValues (handle, argList, argList.length / 2);
return argList [1];
}
-/**
-* Gets the selection.
-* <p>
-* @return the selection
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -171,16 +249,17 @@ public int getSelection () {
OS.XtGetValues (handle, argList, argList.length / 2);
return argList [1];
}
-/**
-* Gets the thumb.
-* <p>
-* @return the thumb value
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -221,19 +300,23 @@ int processSelection (int callData) {
sendEvent (SWT.Selection, event);
return 0;
}
-/**
-* 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
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -242,16 +325,19 @@ public void removeSelectionListener(SelectionListener listener) {
eventTable.unhook(SWT.Selection, listener);
eventTable.unhook(SWT.DefaultSelection,listener);
}
-/**
-* Sets the increment.
-* <p>
-* @param value the new increment
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -259,16 +345,18 @@ public void setIncrement (int value) {
int [] argList = {OS.XmNincrement, value};
OS.XtSetValues (handle, argList, argList.length / 2);
}
-/**
-* Sets the maximum.
-* <p>
-* @param value the new maximum
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -280,16 +368,18 @@ public void setMaximum (int value) {
OS.XtSetValues (handle, argList, argList.length / 2);
display.setWarnings (warnings);
}
-/**
-* Sets the minimum.
-* <p>
-* @param value the new minimum
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -320,16 +410,19 @@ public void setMinimum (int value) {
OS.XtSetValues (handle, argList, argList.length / 2);
display.setWarnings (warnings);
}
-/**
-* Sets the page increment.
-* <p>
-* @param value the new page increment
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -337,16 +430,18 @@ public void setPageIncrement (int value) {
int [] argList = {OS.XmNpageIncrement, value};
OS.XtSetValues (handle, argList, argList.length / 2);
}
-/**
-* Sets the selection.
-* <p>
-* @param value 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
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -358,16 +453,20 @@ public void setSelection (int value) {
OS.XtSetValues (handle, argList, argList.length / 2);
display.setWarnings (warnings);
}
-/**
-* Sets the thumb.
-* <p>
-* @param value the new thumb
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -379,6 +478,27 @@ public void setThumb (int value) {
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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/TabFolder.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/TabFolder.java
index ea02526d3d..3b7a4e72d7 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/TabFolder.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/TabFolder.java
@@ -1,17 +1,36 @@
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.*;
-
-/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
- */
-/**
- * This class emulates a windows TabFolder by using portable
- * graphics and widgets.
+/**
+ * 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 /*final*/ class TabFolder extends Composite {
TabItem items[];
@@ -28,9 +47,32 @@ public /*final*/ class TabFolder extends Composite {
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
/**
- * Construct a TabFolder with the specified parent and style.
- * @param parent org.eclipse.swt.widgets.Composite
- * @param swtStyle int
+ * 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));
@@ -43,12 +85,30 @@ public TabFolder(Composite parent, int style) {
addListener (SWT.Paint, listener);
addListener (SWT.Resize, listener);
}
-/**
-* Adds the listener to receive events.
-* <p>
-*
-* @param listener the 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -74,9 +134,6 @@ static int checkStyle (int style) {
protected void checkSubclass () {
if (!isValidSubclass ()) error (SWT.ERROR_INVALID_SUBCLASS);
}
-/**
-* Computes the preferred size.
-*/
public Point computeSize (int wHint, int hHint, boolean changed) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -103,10 +160,6 @@ public Point computeSize (int wHint, int hHint, boolean changed) {
Rectangle trim = computeTrim (0, 0, width, height);
return new Point (trim.width, trim.height);
}
-/**
- * Answer the bounds of the trimmings when the client area is defined by
- * 'x', 'y', 'width' and 'height'.
- */
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);
@@ -166,7 +219,7 @@ void destroyChild (TabItem item) {
selectedIndex = -1;
topTabIndex = 0;
if (!inDispose){
- Control control = item.getControl();
+ Control control = item.control;
if (control != null && !control.isDisposed()) {
control.setVisible(false);
}
@@ -398,9 +451,6 @@ void ensureVisible(int tabIndex) {
scrollRight();
}
}
-/**
- * Return the client area of the rectangle (in local coordinates).
- */
public Rectangle getClientArea() {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -422,8 +472,20 @@ public Rectangle getClientArea() {
int getImageHeight() {
return imageHeight;
}
-/**
- * Return the tab that is located at the specified 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 TabItem getItem (int index) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -432,8 +494,15 @@ public TabItem getItem (int index) {
if (!(0 <= index && index < getItemCount())) error(SWT.ERROR_INVALID_RANGE);
return items [index];
}
-/**
- * Return the number of tabs in the folder.
+/**
+ * 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);
@@ -443,8 +512,21 @@ public int getItemCount(){
return 0;
else return items.length;
}
-/**
- * Return the tab items.
+/**
+ * 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);
@@ -456,16 +538,28 @@ public TabItem [] getItems() {
return tabItems;
}
/**
- * Answer the area where the two scroll buttons are drawn.
+ * 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);
}
-/**
- * Return the selected tab item, or an empty array if there
- * is no selection.
+/**
+ * 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);
@@ -474,9 +568,16 @@ public TabItem [] getSelection() {
if (selectedIndex == -1) return new TabItem [0];
return new TabItem [] {items[selectedIndex]};
}
-/**
- * Return the index of the selected tab item, or -1 if there
- * is no 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() {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -508,9 +609,22 @@ void handleEvents (Event event){
break;
}
}
-/**
- * Return the index of the specified tab or -1 if the tab is not
- * in the receiver.
+/**
+ * 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);
@@ -759,13 +873,23 @@ void redrawSelectionChange(int oldSelection, int newSelection) {
void redrawTabs() {
redraw(0, 0, super.getClientArea().width, getClientArea().y);
}
-/**
-* Removes the listener.
-* <p>
-*
-* @param listener the 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -813,9 +937,6 @@ void scrollRight() {
}
}
}
-/**
- * The font is changing. Layout the tab items.
- */
public void setFont(Font font) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -825,8 +946,18 @@ public void setFont(Font font) {
layoutItems();
redrawTabs();
}
-/**
- * Set the selection to the tab at the specified 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -855,8 +986,17 @@ public void setSelection(int index) {
}
}
}
-/**
- * Set the selection to the specified items.
+/**
+ * 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[]) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/TabItem.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/TabItem.java
index 012f718cb6..3fe72ef75c 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/TabItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/TabItem.java
@@ -1,16 +1,25 @@
package org.eclipse.swt.widgets;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.graphics.*;
-/**
- * This class emulates a windows TabItem, which represents a tab
- * that can be used to switch to a page in the TabbedFolder.
+/**
+ * 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 /*final*/ class TabItem extends Item {
@@ -40,16 +49,14 @@ public TabItem (TabFolder parent, int style) {
public TabItem (TabFolder parent, int style, int index) {
super (parent, style);
parent.createChild (this, index);
- addListener(SWT.Dispose, new Listener() {
- public void handleEvent(Event event) {disposeItem();}});
}
protected void checkSubclass () {
if (!isValidSubclass ()) error (SWT.ERROR_INVALID_SUBCLASS);
}
-/**
- * Dispose the receiver.
- */
-void disposeItem () {
+
+public void dispose() {
+ if (!isValidWidget ()) return;
+ super.dispose();
parent.destroyChild(this);
parent = null;
control = null;
@@ -73,30 +80,36 @@ void expand(int left, int top, int right, int bottom) {
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
-*/
+/**
+ * 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;
}
-/**
- * Answer the display of the receiver's parent widget.
- */
public Display getDisplay() {
if (parent == null) error(SWT.ERROR_WIDGET_DISPOSED);
return parent.getDisplay();
}
-/**
- * Return the parent of the TabItem.
+/**
+ * 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);
@@ -104,16 +117,17 @@ public TabFolder 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
-*/
+/**
+ * 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);
@@ -219,16 +233,17 @@ int preferredWidth(GC gc) {
return imageWidth() + textWidth(gc) + LEFT_HORIZONTAL_MARGIN +
RIGHT_HORIZONTAL_MARGIN + ICON_MARGIN + SHADOW_WIDTH * 2;
}
-/**
-* 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
-*/
+/**
+ * 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 SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the 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);
@@ -269,18 +284,18 @@ public void setImage (Image image) {
}
}
/**
-* Set the widget text.
-*
-* PARAMETERS
-*
-* string - the new label for the widget
-*
-* REMARKS
-*
-* This method sets the widget label. The label may include
-* the mnemonic characters but must not contain line delimiters.
-*
-**/
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -292,16 +307,17 @@ public void setText (String string) {
parent.itemChanged(this);
}
}
-/**
-* 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
-*/
+/**
+ * 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/motif/org/eclipse/swt/widgets/Table.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Table.java
index c0897e483c..75dc54ff2a 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Table.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Table.java
@@ -1,18 +1,36 @@
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.*;
-
-/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
- */
-/**
- * This class display rows of items arranged in one or more
- * columns. Items can be selected, columns can be resized.
+/**
+ * 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 /*final*/ class Table extends SelectableItemWidget {
private static final int COLUMN_RESIZE_OFFSET = 7; // offset from the start and end of each
@@ -41,9 +59,32 @@ public /*final*/ class Table extends SelectableItemWidget {
// Fix for 1FUSJY5
private int dotsWidth = -1; // width of the static String dots (see above)
/**
- * Create a new instance of Table.
- * @param parent - the parent window of the new instance
- * @param style - window style for the new instance
+ * 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
@@ -101,12 +142,33 @@ void addItem(TableItem item, int index) {
}
addedItem(item, index);
}
-/**
-* Adds the listener to receive events.
-* <p>
-*
-* @param listener the 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.
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -172,6 +234,7 @@ void columnMouseDoubleClick(Event event) {
TableItem hitItem;
TableColumn hitColumn = getColumnAtX(event.x);
Event columnDblClickEvent;
+ boolean isFullSelection = (getStyle() & SWT.FULL_SELECTION) != 0;
if (isFocusControl() == false) {
setFocus(); // focus proxy gets focus here because it's the first child of the receiver
@@ -180,7 +243,7 @@ void columnMouseDoubleClick(Event event) {
itemIndex = (event.y - getHeaderHeight()) / itemHeight + getTopIndex();
hitItem = (TableItem) getVisibleItem(itemIndex);
if (hitItem != null &&
- hitColumn.getIndex() == TableColumn.FIRST) {
+ (hitColumn.getIndex() == TableColumn.FIRST || isFullSelection)) {
if (hitItem.isSelectionHit(event.x) == true) {
columnDblClickEvent = new Event();
columnDblClickEvent.item = hitItem;
@@ -234,10 +297,6 @@ void columnMouseMove(Event event) {
setColumnResizeCursor(false);
}
}
-/**
- * Answer the size of the receiver needed to display all or
- * the first 50 items whichever is less.
- */
public Point computeSize(int wHint, int hHint, boolean changed) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -280,11 +339,22 @@ public Point computeSize(int wHint, int hHint, boolean changed) {
}
return size;
}
-/**
- * Deselect the items identified by the indices stored
- * in 'indices'.
- * A SWT.Selection event will not be sent.
- * @param indices - indices of the items to deselect
+/**
+ * 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[]) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -304,10 +374,17 @@ public void deselect(int indices[]) {
setLastSelection(item, false);
}
}
-/**
- * Deselect the item identified by 'index'.
- * A SWT.Selection event will not be sent.
- * @param index - index of the item to deselect
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -319,12 +396,20 @@ public void deselect(int index) {
setLastSelection(item, false);
}
}
-/**
- * Deselect a range of items starting at index 'start'
- * and stopping at index 'end'. Indices that are out of
- * range are ignored. Indexing is zero based.
- * @param start - the start of the range
- * @param end - the end of the range
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -341,8 +426,13 @@ public void deselect(int start, int end) {
setLastSelection(item, false);
}
}
-/**
- * Deselect all items of the receiver.
+/**
+ * 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() {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -518,8 +608,25 @@ void focusOut(Event event) {
event.widget = this; // the focus event is never sent to the table itself but only to the focus widget
notifyListeners(event.type, event); // make sure that listeners of the table get the focus event, too
}
-/**
- * Answer the TableColumn at 'index'.
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -562,8 +669,22 @@ TableColumn getColumnAtX(int xPosition) {
}
return hitColumn;
}
-/**
- * Answer the number of columns in the receiver.
+/**
+ * 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() {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -595,9 +716,25 @@ Cursor getColumnResizeCursor() {
int getColumnResizeX() {
return columnResizeX;
}
-/**
- * Answer an Array containing all columns of receiver except
- * the fill column to the right of all content columns.
+/**
+ * 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() {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -650,16 +787,14 @@ TableColumn getFillColumn() {
Control getFocusWindow() {
return focusProxy;
}
-/**
-* Gets the width of a grid line.
-* <p>
-* @return the width of a grid line
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -684,10 +819,22 @@ int getHeaderHeight() {
}
return height;
}
-/**
- * Answer whether the header is visible.
- * @return
- * true = header is visible. false = header is not visible
+/**
+ * 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() {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -724,9 +871,20 @@ int getIndex(SelectableItem item) {
}
return index;
}
-/**
- * Answer the TableItem located at 'index' in the receiver.
- * @param index - location of the TableItem object to return
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -738,9 +896,21 @@ public TableItem getItem(int index) {
return (TableItem) getVisibleItem(index);
}
-/**
- * Return the item at the specified position in the widget
- * Return null if the position is outside the widget or in the header widget.
+/**
+ * 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();
@@ -759,8 +929,15 @@ public TableItem getItem(Point point) {
}
return item;
}
-/**
- * Answer the number of items in the receiver.
+/**
+ * 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);
@@ -777,13 +954,16 @@ int getItemCountWhole() {
return clientAreaHeight / 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.
+/**
+ * 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() {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -797,8 +977,21 @@ public int getItemHeight() {
int getItemPadding() {
return getGridLineWidth() + getDisplay().textHighlightThickness + 1;
}
-/**
- * Answer all items of the receiver as an Array.
+/**
+ * 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() {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -815,11 +1008,22 @@ public TableItem [] getItems() {
Vector getItemVector() {
return items;
}
-/**
- * Answer whether the receiver is drawing grid lines.
- * @return
- * true = receiver draws grid lines
- * false = receiver does not draw grid lines
+/**
+ * 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() {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -918,10 +1122,21 @@ int [] getResizeRedrawX(int columnIndex, int columnWidth) {
}
return resizeRedrawX;
}
-/**
- * Answer the selected items of the receiver.
- * @return an Array of TableItems containing the selected items.
- * An empty Array if no items are selected.
+/**
+ * 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() {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -934,8 +1149,15 @@ public TableItem [] getSelection() {
return selectionArray;
}
-/**
- * Answer the number of selected items in the receiver.
+/**
+ * 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() {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -964,8 +1186,16 @@ Point getFullSelectionExtent(TableItem item) {
}
return selectionExtent;
}
-/**
- * Answer the index of the first selected item of the receiver.
+/**
+ * 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);
@@ -977,10 +1207,20 @@ public int getSelectionIndex() {
}
return index;
}
-/**
- * Answer the indices of the selected items of the receiver.
- * @return an Array containing the indices of the selected items.
- * An empty Array if no items are selected.
+/**
+ * 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() {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -993,11 +1233,17 @@ public int [] getSelectionIndices() {
}
return indices;
}
-/**
- * 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.
+/**
+ * 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() {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -1096,9 +1342,6 @@ void handleEvents(Event event) {
boolean hasFirstColumnImage() {
return firstColumnImage;
}
-/**
- * Answer whether the receiver has the input focus.
- */
public boolean isFocusControl() {
return hasColumnFocus;
}
@@ -1137,9 +1380,22 @@ void headerMouseMove(Event event) {
update(); // looks better if resize line is drawn immediately
}
}
-/**
- * Answer the index of 'column' in the receiver or -1 if 'column'
- * does not exist in the receiver.
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -1150,9 +1406,22 @@ public int indexOf(TableColumn column) {
}
return internalGetColumnVector().indexOf(column);
}
-/**
- * Answer the index of 'item' in the receiver or -1 if 'item'
- * does not exist in the receiver.
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -1303,6 +1572,7 @@ Vector internalGetColumnVector() {
*/
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;
@@ -1331,11 +1601,18 @@ boolean isColumnResize(Event event) {
boolean isColumnResizeStarted() {
return (getResizeColumn() != null);
}
-/**
- * Answer whether the item identified by 'index' is selected.
- * @return
- * true=item identified by 'index' is selected
- * false=item identified by 'index' is not selected.
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -1545,10 +1822,22 @@ void reindexColumns(int startIndex) {
column.setIndex(i);
}
}
-/**
- * Remove the items identified by the indices stored in
- * 'indices' from the receiver.
- * @param indices - indices of the items to dispose
+/**
+ * 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[]) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -1576,9 +1865,22 @@ public void remove(int indices[]) {
}
}
}
-/**
- * Remove the item identified by 'index'.
- * @param index - index of the item to dispose
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -1592,13 +1894,24 @@ public void remove(int index) {
error(SWT.ERROR_ITEM_NOT_REMOVED);
}
}
-/**
- * Remove a range of items starting at index 'start' and
- * stopping at index 'end'.
- * This operation will fail when the index is out of range
- * Indexing is zero based.
- * @param start - the start of the range
- * @param end - the end of the range
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -1615,8 +1928,13 @@ public void remove(int start, int end) {
}
}
}
-/**
- * Remove all items of the receiver.
+/**
+ * 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() {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -1718,13 +2036,23 @@ void removeItem(TableItem item) {
}
}
}
-/**
-* Removes the listener.
-* <p>
-*
-* @param listener the 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -1886,11 +2214,22 @@ void scrollVerticalRemovedItem(int index) {
0, destY + itemHeight, // source x, y
clientArea.width, clientArea.height, true);
}
-/**
- * Select the items identified by the indices stored in
- * 'indices'.
- * A SWT.Selection event will not be sent.
- * @param indices - indices of the items to select
+/**
+ * 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[]) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -1916,10 +2255,17 @@ public void select(int indices[]) {
setLastSelection(item, false);
}
}
-/**
- * Select the item identified by 'index'.
- * A SWT.Selection event will not be sent.
- * @param index - index of the item to select
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -1934,12 +2280,19 @@ public void select(int index) {
setLastSelection(item, false);
}
}
-/**
- * Select a range of items starting at index 'start' and
- * stopping at index 'end'. Indices that are out of range
- * are ignored. Indexing is zero based.
- * @param start - the start of the range
- * @param end - the end of the range
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -1967,11 +2320,13 @@ public void select(int start, int end) {
setLastSelection(item, false);
}
}
-/**
- * Select all items of the receiver if it is in multiple
- * selection mode.
- * A SWT.Selection event will not be sent.
- * Do nothing if the receiver is in single selection mode.
+/**
+ * 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() {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -2060,10 +2415,6 @@ void setFirstColumnWidth(TableItem item) {
}
}
}
-/**
- * The font is changing. Trigger a recalculation of the item
- * height using all items of the receiver.
- */
public void setFont(Font font) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -2082,10 +2433,21 @@ public void setFont(Font font) {
setRedraw(true); // re-enable redraw
getHeader().setFont(font);
}
-/**
- * Set whether or not the header is visible.
- * @param headerVisible -
- * true = header is visible. false = header is not visible
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -2110,12 +2472,21 @@ public void setHeaderVisible(boolean headerVisible) {
void setItemVector(Vector newVector) {
items = newVector;
}
-/**
- * Set whether the receiver is drawing grid lines to
- * 'drawGridLines'.
- * @param drawGridLines -
- * true = receiver draws grid lines
- * false = receiver does not draw grid lines
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -2126,13 +2497,6 @@ public void setLinesVisible(boolean drawGridLines) {
redraw();
}
}
-/**
- * Set whether the receiver and it's children should be
- * drawn or not.
- * @param redraw -
- * true = redraw the receiver and its children
- * false = do not draw the receiver or its children
- */
public void setRedraw(boolean redraw) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -2149,22 +2513,23 @@ public void setRedraw(boolean redraw) {
void setResizeColumn(TableColumn column) {
resizeColumn = column;
}
-/**
-* Sets the selection.
-* <p>
-* The previous selection is cleared
-* before new items are selected.
-*
-* @see Table#deselectAll()
-* @see Table#select(int [])
-*
-* @param indices the indices of the items
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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 listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -2183,11 +2548,23 @@ public void setSelection(int [] indices) {
deselectAllExcept(keepSelected);
select(indices);
}
-/**
- * Select the items stored in 'items'.
- * A SWT.Selection event is not going to be sent.
- * @param selectionItems - Array containing the items that should
- * be selected
+/**
+ * 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 Table#deselectAll()
+ * @see Table#select(int)
*/
public void setSelection(TableItem selectionItems[]) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -2198,10 +2575,19 @@ public void setSelection(TableItem selectionItems[]) {
}
setSelectableSelection(selectionItems);
}
-/**
- * Set the selection to the item identified by 'index'.
- * SWT.Selection events are not going to be sent.
- * @param index - index of the item that should be selected
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -2210,12 +2596,20 @@ public void setSelection(int index) {
deselectAllExcept(getVisibleItem(index));
select(index);
}
-/**
- * Set the selection to a range of items starting at index
- * 'start' and stopping at index 'end'. Indices that are out
- * of range are ignored. Indexing is zero based.
- * @param start - the start of the range
- * @param end - the end of the range
+/**
+ * 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 (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -2231,14 +2625,17 @@ public void setSelection(int start, int end) {
deselectAllExcept(keepSelected);
select(start, end);
}
-/**
- * Scroll the item at position 'index' to the top of the receiver.
- * If the scroll operation would result in empty space being
- * displayed below the last item of the receiver, the last item is
- * scrolled into view. This results in the specified item not being
- * displayed at the top of the receiver but after the top item.
- * @param index - 0-based index of the item that should be
- * displayed at the top of the receiver's client area.
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -2267,11 +2664,22 @@ void setTopIndexNoScroll(int index, boolean adjustScrollbar) {
super.setTopIndexNoScroll(index, adjustScrollbar);
moveColumnsVertical();
}
-/**
- * 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.
+/**
+ * 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 listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -2282,11 +2690,20 @@ public void showItem(TableItem item) {
}
showSelectableItem(item);
}
-/**
- * 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.
+/**
+ * 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() {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -2358,4 +2775,4 @@ String trimItemText(String text, int maxWidth, GC gc) {
return text;
}
-} \ No newline at end of file
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/TableColumn.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/TableColumn.java
index 55c9ba604c..dc981d2a72 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/TableColumn.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/TableColumn.java
@@ -1,17 +1,25 @@
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.*;
-
-/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
- */
-/**
- * A TableColumn stores such data as column label, label alignmentand size.
- * It routes paint requests to the corresponding table item.
+/**
+ * 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 /*final*/ class TableColumn extends Item {
static final int FIRST = 0; // index of the first column
@@ -67,19 +75,25 @@ public TableColumn(Table parent, int style, int index) {
public void handleEvent(Event event) {disposeColumn();}
});
}
-/**
-* 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
-*/
+/**
+ * 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);
@@ -88,19 +102,30 @@ public void addControlListener(ControlListener listener) {
addListener (SWT.Resize,typedListener);
addListener (SWT.Move,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
-*/
+/**
+ * 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);
@@ -154,20 +179,18 @@ static TableColumn createFillColumn(Table parent) {
void disposeColumn() {
getParent().removeColumn(this);
}
-/**
-* Gets the alignment.
-* <p>
-* The alignment of a widget controls the position of the
-* text or image in the widget. The alignment may be one
-* of LEFT, RIGHT or CENTER.
-*
-* @return the alignment
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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);
@@ -183,9 +206,6 @@ public int getAlignment () {
Rectangle getBounds() {
return new Rectangle(bounds.x, bounds.y, bounds.width, bounds.height); // copy the object to prevent changes
}
-/**
- * Gets the Display.
- */
public Display getDisplay() {
if (parent == null) { // access parent field directly to prevent endless recursion
error(SWT.ERROR_WIDGET_DISPOSED);
@@ -199,8 +219,15 @@ public Display getDisplay() {
int getIndex() {
return index;
}
-/**
- * Answer the parent widget of the receiver.
+/**
+ * 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);
@@ -208,32 +235,34 @@ public Table getParent() {
return parent;
}
-/**
-* Gets the resize attribute.
-* <p>
-* @return the resize attribute
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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);
return resize;
}
-/**
-* Gets the width.
-* <p>
-* @return the width
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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);
@@ -256,17 +285,17 @@ void internalSetBounds(Rectangle newBounds) {
boolean isDefaultWidth() {
return isDefaultWidth;
}
-/**
-* Packs the widget.
-* <p>
-* Packing a widget causes it to be resized to the
-* preferred size for 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
-*/
+/**
+ * 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);
@@ -289,19 +318,23 @@ void paint(TableItem item, GC gc, int yPosition) {
item.paint(gc, paintPosition, this);
}
-/**
-* 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
-*/
+/**
+ * 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);
@@ -310,19 +343,23 @@ public void removeControlListener (ControlListener listener) {
eventTable.unhook (SWT.Move, listener);
eventTable.unhook (SWT.Resize, 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
-*/
+/**
+ * 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);
@@ -333,20 +370,18 @@ public void removeSelectionListener(SelectionListener listener) {
removeListener(SWT.Selection, listener);
removeListener(SWT.DefaultSelection, listener);
}
-/**
-* Sets the alignment.
-* <p>
-* The alignment of a widget controls the position of the
-* text or image in the widget. The alignement may be one
-* of LEFT, RIGHT or CENTER.
-*
-* @param alignment the new alignment
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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);
@@ -396,25 +431,24 @@ void setDefaultWidth(boolean isDefaultWidth) {
void setIndex(int newIndex) {
this.index = newIndex;
}
-/**
-* Sets the resize attribute.
-* <p>
-* @param resizee the resize attribute
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
this.resize = resize;
}
-/**
- * Set the text of the receiver to 'text'.
- */
public void setText(String newText) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -428,16 +462,16 @@ public void setText(String newText) {
getParent().getHeader().redraw(index);
}
}
-/**
-* Sets the width.
-* <p>
-* @param width the width
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/TableItem.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/TableItem.java
index 6919d84766..6da0ba377e 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/TableItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/TableItem.java
@@ -1,18 +1,26 @@
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.*;
-/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
- */
-
/**
- * A table item is a selectable user interface object
+ * Instances of this class represent a selectable user interface object
* that represents an item in a table.
- * Table items can consist of multiple columns called sub items.
+ * <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 /*final*/ class TableItem extends SelectableItem {
private static final int FIRST_COLUMN_IMAGE_INDENT = 2; // Space in front of image - first column only
@@ -87,17 +95,20 @@ static Table checkNull(Table table) {
protected void checkSubclass () {
if (!isValidSubclass ()) error (SWT.ERROR_INVALID_SUBCLASS);
}
-/**
- * The receiver is destroyed. Remove it from its parent widget.
- */
-void disposeItem() {
- getParent().removeItem(this);
+public void dispose() {
+ if (!isValidWidget ()) return;
+ Table parent = getParent();
+ parent.removeItem(this);
+ super.dispose();
+}
+void doDispose() {
dataLabels = null;
trimmedLabels = null;
images = null;
selectionExtent = null;
- super.disposeItem();
+ super.doDispose();
}
+
/**
* Draw the image of the receiver for column 'index' at
* 'destinationPosition' using 'gc'.
@@ -170,15 +181,17 @@ void drawText(String label, GC gc, Point position, int index) {
}
/**
-* Gets the item bounds at an index
-* <p>
-* @return the item bounds
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+ * 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);
@@ -216,9 +229,16 @@ public Rectangle getBounds(int index) {
return itemBounds;
}
/**
- * Return whether or not the receiver is checked.
- * Always return false if the parent of the receiver does not
- * have the CHECK style.
+ * 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() {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -242,9 +262,6 @@ int getCheckboxXPosition() {
Vector getDataLabels() {
return dataLabels;
}
-/**
- * Answer the display of the receiver's parent widget.
- */
public Display getDisplay() {
return super.getDisplay();
}
@@ -279,14 +296,16 @@ int getDotStartX(int columnIndex, int columnWidth) {
return dotStartX;
}
/**
- * Gets the grayed state.
- * <p>
- * @return the item grayed state.
+ * 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 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>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if 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);
@@ -294,9 +313,6 @@ public boolean getGrayed() {
return super.getGrayed();
}
-/**
- * Answer the item image of the first column.
- */
public Image getImage() {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -304,9 +320,11 @@ public Image getImage() {
return getImage(0);
}
/**
- * Answer the item image of the column identified by 'columnIndex' or
+ * 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 answered
+ *
+ * @param columnIndex - the column whose image should be returned
+ * @return the item image
*/
public Image getImage(int columnIndex) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -321,15 +339,18 @@ public Image getImage(int columnIndex) {
return image;
}
/**
-* Gets the image bounds at an index
-* <p>
-* @return the item icon's bounds
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+ * 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);
@@ -353,15 +374,15 @@ public Rectangle getImageBounds(int index) {
return imageBounds;
}
/**
-* Gets the image indent.
-* <p>
-* @return the indent
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+ * 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() == false) error(SWT.ERROR_THREAD_INVALID_ACCESS);
if (isValidWidget() == false) error(SWT.ERROR_WIDGET_DISPOSED);
@@ -462,7 +483,14 @@ int getMaxTextWidth(int columnIndex, int columnWidth) {
return columnWidth - itemWidth;
}
/**
- * Answer the parent widget of the receiver.
+ * 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);
@@ -510,9 +538,6 @@ Point getSelectionExtent() {
int getSelectionX() {
return getImageStopX(TableColumn.FIRST) + getParent().getHorizontalOffset();
}
-/**
- * Answer the item text of the first column.
- */
public String getText() {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -520,10 +545,11 @@ public String getText() {
return getText(0);
}
/**
- * Answer the item tezt of the column identified by 'columnIndex'.
- * Answer null if no text has been set for that column.
- * @param columnIndex - the column whose text should be answered.
- * null if no text has been set for that column.
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -653,7 +679,7 @@ void insertColumn(TableColumn column) {
}
/**
* Sets the image at an index.
- * <p>
+ *
* @param image the new image (or null)
*
* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
@@ -681,7 +707,6 @@ void internalSetImage(int columnIndex, Image 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
@@ -846,8 +871,18 @@ void reset(int index) {
}
}
/**
-* Warning: API under construction.
-*/
+ * Sets the image for multiple columns in the Table.
+ *
+ * @param strings the array of new images
+ *
+ * @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 setImage(Image [] images) {
if (!isValidThread()) error(SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget()) error(SWT.ERROR_WIDGET_DISPOSED);
@@ -863,14 +898,18 @@ public void setImage(Image [] images) {
}
}
/**
- * Sets the image at an index.
- * <p>
- * @param image the new image (or null)
+ * Sets the receiver's image at a column.
*
- * @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
- * when called from the wrong thread
- * @exception SWTError(ERROR_WIDGET_DISPOSED)
- * when the widget has been disposed
+ * @param index the column index
+ * @param string the new image
+ *
+ * @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 setImage(int columnIndex, Image image) {
if (!isValidThread()) error(SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -880,11 +919,6 @@ public void setImage(int columnIndex, Image image) {
internalSetImage(columnIndex, image);
}
}
-/**
- * Set the item image of the first column to 'image'.
- * @param image - the item image of the first column. Image
- * will be removed if this is null.
- */
public void setImage(Image image) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -892,15 +926,16 @@ public void setImage(Image image) {
setImage(0, image);
}
/**
-* Sets the image indent.
-* <p>
-* @param indent the new indent
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+ * 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);
@@ -917,7 +952,17 @@ public void setImageIndent(int indent) {
}
}
/**
- * Warning: API under construction.
+ * 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);
@@ -937,23 +982,19 @@ public void setText(String [] strings) {
}
}
/**
-* 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(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
-*/
+ * 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 columnIndex, String string) {
if (!isValidThread()) error(SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget()) error(SWT.ERROR_WIDGET_DISPOSED);
@@ -965,11 +1006,6 @@ public void setText (int columnIndex, String string) {
internalSetText(columnIndex, string);
}
}
-/**
- * Set the item text of the first column to 'text'.
- * @param text - the item text of the first column. May be null if the
- * text label should be removed.
- */
public void setText(String text) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -997,8 +1033,14 @@ void setTrimmedText(String label, int columnIndex) {
}
}
/**
- * Set the checked state to 'checked' if the parent of the
- * receiver has the CHECK style.
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -1007,14 +1049,14 @@ public void setChecked(boolean checked) {
super.setChecked(checked);
}
/**
- * Sets the grayed state.
- * <p>
- * @param grayed the new grayed state.
+ * Sets the grayed state of the receiver.
+ *
+ * @param checked 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>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
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
index ccb7d4dd5f..e75c3305ec 100755
--- 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
@@ -1,33 +1,30 @@
package org.eclipse.swt.widgets;
/*
-* Licensed Materials - Property of IBM,
-* SWT - The Simple Widget Toolkit,
-* (c) Copyright IBM Corp 1998, 1999.
-*/
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
-/* Imports */
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.*;
-/**
-* A Text is an editable user interface object that
-* displays a single line of text or multiple lines
-* of text.
-* <p>
-* <b>Styles</b><br>
-* <dd>SINGLE, MULTI,<br>
-* <dd>READ_ONLY, WRAP<br>
-* <br>
-* <b>Events</b><br>
-* <dd>Modify<br>
-* <dd>Verify<br>
-*/
+/**
+ * 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.
+ */
-/* Class Definition */
public class Text extends Scrollable {
char echoCharacter;
boolean ignoreChange;
@@ -48,24 +45,55 @@ public class Text extends Scrollable {
DELIMITER = "\n";
}
/**
-* Creates a new instance of the 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 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 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
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -73,19 +101,30 @@ public void addModifyListener (ModifyListener listener) {
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
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -94,19 +133,25 @@ public void addSelectionListener(SelectionListener listener) {
addListener(SWT.Selection,typedListener);
addListener(SWT.DefaultSelection,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
-*/
+/**
+ * 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);
@@ -114,19 +159,23 @@ public void addVerifyListener (VerifyListener listener) {
TypedListener typedListener = new TypedListener (listener);
addListener (SWT.Verify, typedListener);
}
-/**
-* Appends a string.
-* <p>
-*
-* @param string the string to be appended
-*
-* @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
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -150,15 +199,14 @@ static int checkStyle (int style) {
}
return style | SWT.SINGLE;
}
-/**
-* Clears the 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
-*/
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -166,9 +214,6 @@ public void clearSelection () {
if (xDisplay == 0) return;
OS.XmTextClearSelection (handle, OS.XtLastTimestampProcessed (xDisplay));
}
-/**
-* Computes the preferred size.
-*/
public Point computeSize (int wHint, int hHint, boolean changed) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -243,15 +288,17 @@ public Rectangle computeTrim (int x, int y, int width, int height) {
if ((style & (SWT.MULTI | SWT.BORDER)) != 0) trim.height += 3;
return trim;
}
-/**
-* Copies the selected text to the clipboard.
-*
-* <p>
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -271,23 +318,23 @@ void createHandle (int index) {
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 (parent.handle, null, argList1, argList1.length / 2);
+ handle = OS.XmCreateTextField (parentHandle, null, argList1, argList1.length / 2);
if (handle == 0) error (SWT.ERROR_NO_HANDLES);
- int [] argList2 = new int [] {
- OS.XmNcursorPositionVisible, 0,
- };
+ 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.XmNshadowThickness, 0,
};
OS.XtSetValues (handle, argList3, argList3.length / 2);
}
} else {
- handle = OS.XmCreateScrolledText (parent.handle, null, argList1, argList1.length / 2);
+ handle = OS.XmCreateScrolledText (parentHandle, null, argList1, argList1.length / 2);
if (handle == 0) error (SWT.ERROR_NO_HANDLES);
scrolledHandle = OS.XtParent (handle);
}
@@ -295,6 +342,21 @@ void createHandle (int index) {
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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -311,23 +373,40 @@ int defaultFont () {
int defaultForeground () {
return getDisplay ().textForeground;
}
-/**
-* Gets the line number of the caret.
-* <p>
-* The line number of the caret is returned.
-*
-* @return the line number
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -341,47 +420,52 @@ public Point getCaretLocation () {
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.
-*
-* @return the position of the caret
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
return OS.XmTextGetInsertionPosition (handle);
}
-/**
-* Gets the number of characters.
-* <p>
-*
-* @return number of characters 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
-*/
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
return OS.XmTextGetLastPosition (handle);
}
-/**
-* Gets the double click enabled flag.
-* <p>
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -389,19 +473,32 @@ public boolean getDoubleClickEnabled () {
OS.XtGetValues (handle, argList, argList.length / 2);
return argList [1] != 1;
}
-/**
-* Gets the echo character.
-* <p>
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -416,39 +513,46 @@ public boolean getEditable () {
OS.XtGetValues (handle, argList, argList.length / 2);
return argList [1] != 0;
}
-/**
-* Gets the number of lines.
-*/
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
return getLineNumber (echoCharacter != '\0' ? hiddenText.length () : OS.XmTextGetLastPosition (handle));
}
-/**
-* Gets the line delimiter.
-* <p>
-* @return a string that is the line delimiter
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
return "\n";
}
-/**
-* Gets the height of each line.
-* <p>
-* @return the height (in pixels) of each row 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
-*/
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -489,16 +593,21 @@ int getLineNumber (int position) {
}
return count;
}
-/**
-* Gets the position of the selected text.
-* <p>
-* @return a point (a pair of ints) that represent the beginning and end of the current selection
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -512,16 +621,16 @@ public Point getSelection () {
}
return new Point (start [0], end [0]);
}
-/**
-* Gets the number of selected characters.
-* <p>
-* @reurn the number of selected characters.
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -532,18 +641,16 @@ public int getSelectionCount () {
OS.XmTextGetSelectionPosition (handle, start, end);
return end [0] - start [0];
}
-/**
-* Gets the selected text.
-* <p>
-* If no text is selected an empty string is returned.
-*
-* @return the selected text
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -559,34 +666,40 @@ public String getSelectionText () {
OS.XtFree (ptr);
return new String (Converter.mbcsToWcs (null, buffer));
}
-/**
-* Gets the number of space characters used to represent one tab.
-* <p>
-* @return the number of space characters that are used to represent one tab ('\t') character
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
/* Tabs are not supported in MOTIF. */
return 8;
}
-/**
-* Gets the text.
-* <p>
-* If there is no text in the widget, an empty string is returned.
-*
-* @return the content of 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
-*/
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -599,21 +712,23 @@ public String getText () {
OS.XtFree (ptr);
return new String (Converter.mbcsToWcs (null, buffer));
}
-/**
-* Gets the text.
-* <p>
-* Indexing is zero based. The range of text
-* is from the start index up to and including
-* the end index + 1.
-*
-* @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
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -632,34 +747,39 @@ public String getText (int start, int end) {
}
return new String (unicode, 0, numChars);
}
-/**
-* Gets the text limit.
-* <p>
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
return OS.XmTextGetMaxLength (handle);
}
-/**
-* Gets the top index.
-* <p>
-* The top index is the index of the line that
-* is currently at the top of the widget. The
-* top index changes when the widget is scrolled.
-* Indexing is zero based.
-*
-* @return the index of the top line
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -672,25 +792,26 @@ public int getTopIndex () {
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>
-* The top pixel changes when the widget is scrolled.
-* The top pixel does not include the widget trimming.
-*
-* @return the pixel position of the top line
-*
-* @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>
-*/
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -714,21 +835,19 @@ int inputContext () {
/* Answer zero. The text widget uses the default MOTIF input context. */
return 0;
}
-/**
-* Replaces the selection with a string.
-* <p>
-* If the no text is selected (the beginning and the end of the selection are equal)
-* the string is inserted.
-*
-* @param string the string
-*
-* @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
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -747,6 +866,18 @@ public void insert (String string) {
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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -768,6 +899,8 @@ public void paste () {
}
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};
@@ -776,6 +909,8 @@ int processFocusIn () {
}
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};
@@ -837,19 +972,23 @@ int processVerify (int callData) {
textVerify = null;
return 0;
}
-/**
-* 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
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -857,19 +996,23 @@ public void removeModifyListener (ModifyListener listener) {
if (eventTable == null) return;
eventTable.unhook (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
-*/
+/**
+ * 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);
@@ -878,19 +1021,23 @@ public void removeSelectionListener(SelectionListener listener) {
eventTable.unhook(SWT.Selection, listener);
eventTable.unhook(SWT.DefaultSelection,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
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -898,15 +1045,14 @@ public void removeVerifyListener (VerifyListener listener) {
if (eventTable == null) return;
eventTable.unhook (SWT.Verify, listener);
}
-/**
-* Selects all of the text.
-* <p>
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -957,28 +1103,42 @@ public void setBounds (int x, int y, int width, int height) {
// nWidth > inset x ifTrue: [^self].
// self showPosition: self topCharacter
}
-/**
-* Sets the double click enabled flag.
-* <p>
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
int [] argList = {OS.XmNselectionArrayCount, doubleClick ? 4 : 1};
OS.XtSetValues (handle, argList, argList.length / 2);
}
-/**
-* Sets the echo character.
-* <p>
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -998,6 +1158,16 @@ public void setEchoChar (char echo) {
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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -1021,16 +1191,32 @@ public void setRedraw (boolean redraw) {
if (drawCount++ == 0) OS.XmTextDisableRedisplay(handle);
}
}
-/**
-* Sets the selection.
-* <p>
-* @param start new i-beam position
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -1050,21 +1236,33 @@ public void setSelection (int start) {
OS.XmTextSetInsertionPosition (handle, nStart);
display.setWarnings (warnings);
}
-/**
-* Sets the selection.
-* <p>
-* Indexing is zero based. The range of text
-* is from the start index up to and including
-* the end index + 1.
-*
-* @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
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -1097,28 +1295,38 @@ public void setSelection (int start, int end) {
OS.XmTextSetInsertionPosition (handle, nEnd);
display.setWarnings (warnings);
}
-/**
-* Sets the selection.
-* <p>
-* @param selection the point whose x and y fields specify the beginning 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
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
if (selection == null) error (SWT.ERROR_NULL_ARGUMENT);
setSelection (selection.x, selection.y);
}
-/**
-* Sets the size.
-*/
public void setSize (int width, int height) {
super.setSize (width, height);
/*
@@ -1136,33 +1344,40 @@ public void setSize (int width, int height) {
// nWidth > inset x ifTrue: [^self].
// self showPosition: self topCharacter
}
-/**
-* Sets the number of space characters used to represent one tab.
-* <p>
-* @return the number of space characters that are used to represent one tab ('\t') character
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
+ /**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
/* Do nothing. Tabs are not supported in MOTIF. */
}
-/**
-* Sets the text.
-* <p>
-* @param string the new 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
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -1181,37 +1396,38 @@ public void setText (String string) {
*/
if (IsLinux && (style & SWT.MULTI) != 0) sendEvent (SWT.Modify);
}
-/**
-* Sets the text limit.
-* <p>
-* @param limit the 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
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
if (limit == 0) error (SWT.ERROR_CANNOT_BE_ZERO);
OS.XmTextSetMaxLength (handle, limit);
}
-/**
-* Sets the top index.
-* <p>
-* The top index is the index of the line that
-* is currently at the top of the widget. The
-* top index changes when the widget is scrolled.
-* Indexing starts from zero.
-*
-* @param index the new top index
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -1230,20 +1446,22 @@ void setWrap (boolean wrap) {
int [] argList = {OS.XmNwordWrap, wrap ? 1 : 0};
OS.XtSetValues (handle, argList, argList.length / 2);
}
-/**
-* 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(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
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
index 4ed8ef2251..2bcd850d7d 100755
--- 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
@@ -1,37 +1,78 @@
package org.eclipse.swt.widgets;
/*
-* Licensed Materials - Property of IBM,
-* SWT - The Simple Widget Toolkit,
-* (c) Copyright IBM Corp 1998, 1999.
-*/
-
-/**
-* The tool bar class supports the layout of
-* selectable tool bar items.
-*
-* Styles
-*
-* WRAP, FLAT
-*
-* Events
-*
-**/
-
-/* Imports */
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
import org.eclipse.swt.internal.motif.*;
import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
-/* Class Definition */
+/**
+ * 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 /*final*/ class ToolBar extends Composite {
int drawCount, itemCount;
ToolItem [] items;
-/**
-* Creates a new instance of the 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 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) {
/*
@@ -46,9 +87,6 @@ static int checkStyle (int style) {
protected void checkSubclass () {
if (!isValidSubclass ()) error (SWT.ERROR_INVALID_SUBCLASS);
}
-/**
-* Computes the preferred size.
-*/
public Point computeSize (int wHint, int hHint, boolean changed) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -96,6 +134,21 @@ void destroyItem (ToolItem item) {
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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -105,6 +158,22 @@ public ToolItem getItem (int index) {
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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -116,11 +185,37 @@ public ToolItem getItem (Point pt) {
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);
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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -128,12 +223,42 @@ public ToolItem [] getItems () {
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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
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 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 (ToolItem item) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -144,7 +269,7 @@ public int indexOf (ToolItem item) {
}
return -1;
}
-int [] layout (int nWidth, int nHeight, boolean resize) {
+int [] layoutHorizontal (int nWidth, int nHeight, boolean resize) {
int xSpacing = 0, ySpacing = 4;
int marginWidth = 0, marginHeight = 0;
ToolItem [] children = getItems ();
@@ -169,6 +294,38 @@ int [] layout (int nWidth, int nHeight, boolean resize) {
}
return new int [] {rows, maxX, y + maxHeight};
}
+int [] layoutVertical (int nWidth, int nHeight, boolean resize) {
+ int xSpacing = 4, 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);
+ }
+}
void relayout () {
if (drawCount > 0) return;
Rectangle rect = getClientArea ();
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
index 6a84ef8a75..b07006797f 100755
--- 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
@@ -1,5 +1,10 @@
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.*;
@@ -28,4 +33,4 @@ public int internal_new_GC (GCData data) {
public void internal_dispose_GC (int xGC, GCData data) {
OS.XFreeGC (display, xGC);
}
-} \ No newline at end of file
+}
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
index 17b8beac50..e3a291c072 100755
--- 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
@@ -1,36 +1,35 @@
package org.eclipse.swt.widgets;
/*
-* Licensed Materials - Property of IBM,
-* SWT - The Simple Widget Toolkit,
-* (c) Copyright IBM Corp 1998, 1999.
-*/
-
-/* Imports */
+ * (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.*;
-/**
-* A tool item is a selectable user interface object
-* that represents a button in a tool bar.
-*
-* <p>
-* <b>Styles</b><br>
-* <dd>CHECK, PUSH, RADIO, SEPARATOR<br>
-* <b>Events</b><br>
-* <dd>Selection<br>
-*/
-
-/* Class Definition */
+/**
+ * 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 /*final*/ class ToolItem extends Item {
ToolBar parent;
Image hotImage, disabledImage;
String toolTipText;
Control control;
- boolean set, drawHotImage;
+ boolean set;
/**
* Creates a new instance of the widget.
@@ -39,6 +38,7 @@ public ToolItem (ToolBar parent, int style) {
super (parent, checkStyle (style));
this.parent = parent;
parent.createItem (this, parent.getItemCount ());
+ parent.relayout ();
}
/**
* Creates a new instance of the widget.
@@ -47,20 +47,33 @@ 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 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
-*/
+/**
+ * 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);
@@ -85,6 +98,7 @@ void createHandle (int index) {
OS.XmNrecomputeSize, 0,
OS.XmNpositionIndex, index,
OS.XmNmappedWhenManaged, 0,
+ OS.XmNancestorSensitive, 1,
};
handle = OS.XmCreateDrawnButton (parentHandle, null, argList, argList.length / 2);
if (handle == 0) error (SWT.ERROR_NO_HANDLES);
@@ -100,32 +114,36 @@ void createHandle (int index) {
OS.XmNtraversalOn, 0,
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);
- if ((parent.style & SWT.FLAT) != 0) {
- argList = new int [] {OS.XmNshadowThickness, 0};
- OS.XtSetValues (handle, argList, argList.length / 2);
- }
}
Point computeSize () {
- //if (control != null) return control.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
-
+ 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.XmNhighlightThickness, 0,
};
OS.XtGetValues (handle, argList, argList.length / 2);
- int marginHeight = argList[1];
- int marginWidth = argList[3];
- int shadowThickness = 2; //argList[5];
- int highlightThickness = argList[7];
-
+ 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 != null && text.length() > 0) {
+ if (text.length () != 0) {
GC gc = new GC (parent);
Point textExtent = gc.textExtent (text);
textWidth = textExtent.x;
@@ -133,41 +151,34 @@ Point computeSize () {
gc.dispose ();
}
int imageWidth = 0, imageHeight = 0;
- if (image != null) {
- Rectangle rect = image.getBounds();
+ if (image != null) {
+ Rectangle rect = image.getBounds ();
imageWidth = rect.width;
- imageHeight= rect.height;
+ imageHeight = rect.height;
}
-
- int contentHeight = 0, contentWidth = 0;
- if ((parent.style & SWT.RIGHT) > 0) {
- contentHeight = Math.max(imageHeight, textHeight);
- contentWidth = imageWidth + textWidth;
- if (imageWidth > 0 && textWidth > 0) contentWidth += marginWidth;
+ 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 {
- contentHeight = imageHeight + textHeight;
- if (imageHeight > 0 && textHeight > 0) contentHeight += marginHeight;
- contentWidth = Math.max(imageWidth, textWidth);
+ height = imageHeight + textHeight;
+ if (imageHeight != 0 && textHeight != 0) height += 2;
+ width = Math.max (imageWidth, textWidth);
}
+ if ((style & SWT.DROP_DOWN) != 0) width += 12;
- /* This value comes from Windows */
- int height = 22;
- if (contentHeight != 0) {
- height = contentHeight
- + (2 * marginHeight)
- + (2 * shadowThickness)
- + (2 * highlightThickness);
+ /* The 24 and 22 values come from Windows */
+ if (width != 0) {
+ width += (marginWidth + shadowThickness) * 2 + 2;
+ } else {
+ width = 24;
}
-
- /* This value comes from Windows */
- int width = 24;
- if (contentWidth != 0) {
- width = contentWidth
- + (2 * marginWidth)
- + (2 * shadowThickness)
- + (2 * highlightThickness);
+ if (height != 0) {
+ height += (marginHeight + shadowThickness) * 2 + 2;
+ } else {
+ height = 22;
}
-
return new Point (width, height);
}
void createWidget (int index) {
@@ -176,10 +187,22 @@ void createWidget (int index) {
parent.relayout ();
}
public void dispose () {
+ if (!isValidWidget ()) 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -187,16 +210,17 @@ public Rectangle getBounds () {
OS.XtGetValues (handle, argList, argList.length / 2);
return new Rectangle ((short) argList [1], (short) argList [3], argList [5], argList [7]);
}
-/**
-* 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
-*/
+/**
+ * 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);
@@ -217,20 +241,21 @@ public Image getDisabledmage () {
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
return disabledImage;
}
-/**
-* Gets the enabled state.
-* <p>
-* A disabled widget is typically not selectable from
-* the user interface and draws with an inactive or
-* grayed look.
-*
-* @return a boolean that is the enabled state of 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
-*/
+/**
+ * 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);
@@ -238,75 +263,92 @@ public boolean getEnabled () {
OS.XtGetValues (handle, argList, argList.length / 2);
return argList [1] != 0;
}
-/**
-* Gets the Display.
-*/
public Display getDisplay () {
Composite parent = this.parent;
if (parent == null) error (SWT.ERROR_WIDGET_DISPOSED);
return parent.getDisplay ();
}
-/**
-* Gets the hot image.
-* <p>
-* @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
-*/
+/**
+ * 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 hotImage;
}
-/**
-* Gets the parent.
-* <p>
-* @return the parent
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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;
}
-/**
-* Gets the selection state.
-* <p>
-* @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
-*/
+/**
+ * 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 set;
}
-/**
-* Gets the hover help text.
-* <p>
-* @return the hover help text
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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;
}
+/**
+ * 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);
@@ -314,32 +356,44 @@ public int getWidth () {
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.XtAddCallback (handle, OS.XmNexposeCallback, windowProc, SWT.Paint);
-// OS.XtAddCallback (handle, OS.XmNactivateCallback, windowProc, SWT.Selection);
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);
}
-/**
-* Gets the enabled status.
-* <p>
-* When an ancestor of the widget is disabled, the enabled
-* stats of the widget in the widget hierarchy is disabled
-* regardless of the actual enabled state of the widget.
-*
-* @param enabled a boolean that is the enabled state.
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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);
@@ -348,41 +402,43 @@ public boolean isEnabled () {
void manageChildren () {
OS.XtManageChild (handle);
}
-int processSelection (int callData) {
- if ((style & SWT.RADIO) != 0) {
- selectRadio ();
- } else {
- if ((style & SWT.CHECK) != 0) setSelection(!set);
- }
- postEvent (SWT.Selection);
- return 0;
+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 () {
- getDisplay ().releaseToolTipHandle (handle);
+ Display display = getDisplay ();
+ display.releaseToolTipHandle (handle);
super.releaseWidget ();
parent = null;
control = null;
toolTipText = null;
- disabledImage = hotImage = null;
-}
-/**
-* 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
-*/
+ 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -416,16 +472,17 @@ void setBounds (int x, int y, int width, int height) {
int newWidth = Math.max (width, 1), newHeight = Math.max (height, 1);
OS.XtConfigureWidget (handle, x, y, newWidth, newHeight, 0);
}
-/**
-* 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
-*/
+/**
+ * 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 SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the 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);
@@ -438,142 +495,148 @@ public void setControl (Control control) {
control.setBounds (getBounds ());
}
}
-/**
-* 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 value of the enabled flag
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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);
int [] argList = {OS.XmNsensitive, enabled ? 1 : 0};
OS.XtSetValues (handle, argList, argList.length / 2);
}
-/**
-* Sets the hot 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
-*/
+/**
+ * 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 hot image to display on the receiver (may be 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 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;
-}
-/**
-* Sets the hot 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
-*/
+ 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 SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the 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;
+ if ((parent.style & SWT.FLAT) != 0) redraw ();
}
-/**
-* Sets the widget image.
-* <p>
-* @param image the widget 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 (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if ((style & SWT.SEPARATOR) != 0) return;
super.setImage (image);
-
- /* Resize */
- int [] argList = {OS.XmNwidth, 0, OS.XmNheight, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- Point size = computeSize();
- if (argList[1] != size.x || argList[3] != size.y) {
- OS.XtResizeWidget (handle, size.x, size.y, 0);
- }
- parent.relayout ();
+ Point size = computeSize ();
+ setSize (size.x, size.y);
+ redraw ();
}
-/**
-* Sets the selection state.
-* <p>
-* @param selected the new 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
-*/
+/**
+ * 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;
if (selected == set) return;
set = selected;
- setDrawPressed(set);
- if ((parent.style & SWT.FLAT) != 0) {
- int shadowThickness = set ? getDisplay().buttonShadowThickness : 0;
- int [] argList = {OS.XmNshadowThickness, shadowThickness};
- OS.XtSetValues (handle, argList, argList.length / 2);
+ 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 ();
}
}
-/**
-* Sets the widget text.
-*/
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;
super.setText (string);
-
- /* Resize */
- int [] argList = {OS.XmNwidth, 0, OS.XmNheight, 0};
- OS.XtGetValues (handle, argList, argList.length / 2);
- Point size = computeSize();
- if (argList[1] != size.x || argList[3] != size.y) {
- OS.XtResizeWidget (handle, size.x, size.y, 0);
- }
- parent.relayout ();
+ Point size = computeSize ();
+ setSize (size.x, size.y);
+ redraw ();
}
-/**
-* Sets the hover help text.
-* <p>
-* @param string the hover help 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
-*/
+/**
+ * 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;
}
-
+/**
+ * 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);
@@ -581,118 +644,178 @@ public void setWidth (int width) {
if (width < 0) return;
int [] argList = {OS.XmNheight, 0};
OS.XtGetValues (handle, argList, argList.length / 2);
- OS.XtResizeWidget (handle, width, argList [1], 0);
- parent.relayout ();
+ 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 processMouseDown (int callData) {
- getDisplay ().hideToolTip();
- if (set && (style & SWT.RADIO) != 0) return 0;
- setDrawPressed(!set);
+ Display display = getDisplay ();
+ 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);
+
return 0;
}
-
int processMouseEnter (int callData) {
- if ((parent.style & SWT.FLAT) != 0) {
- int [] argList = {OS.XmNshadowThickness, getDisplay().buttonShadowThickness};
- OS.XtSetValues (handle, argList, argList.length / 2);
- }
-
XCrossingEvent xEvent = new XCrossingEvent ();
OS.memmove (xEvent, callData, XCrossingEvent.sizeof);
- boolean button1Pressed = (xEvent.state & OS.Button1Mask) != 0;
- if (button1Pressed) {
- setDrawPressed(!set);
- }
- drawHotImage = (parent.style & SWT.FLAT) != 0 && hotImage != null;
- if (drawHotImage) {
- OS.XClearArea (xEvent.display, xEvent.window, 0, 0, 0, 0, true);
- }
+ 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 ();
-
- if ((parent.style & SWT.FLAT) != 0 && !set) {
- int [] argList = {OS.XmNshadowThickness, 0};
- OS.XtSetValues (handle, argList, argList.length / 2);
- }
-
XCrossingEvent xEvent = new XCrossingEvent ();
OS.memmove (xEvent, callData, XCrossingEvent.sizeof);
- boolean button1Pressed = (xEvent.state & OS.Button1Mask) != 0;
- if (button1Pressed) {
- setDrawPressed(set);
- }
- if (drawHotImage) {
- drawHotImage = false;
- OS.XClearArea (xEvent.display, xEvent.window, 0, 0, 0, 0, true);
- }
+ 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]);
}
-
int processMouseHover (int id) {
- Display display = getDisplay();
- Point local = toControl(display.getCursorLocation());
- display.showToolTip(handle, toolTipText);
+ Display display = getDisplay ();
+ Point local = toControl (display.getCursorLocation ());
+ display.showToolTip (handle, toolTipText);
return 0;
}
-
int processMouseMove (int callData) {
Display display = getDisplay ();
display.addMouseHoverTimeOut (handle);
- return 0;
-}
-
-int processMouseUp (int callData) {
- getDisplay ().hideToolTip();
- /**
- * Bug in Motif. The activate callback is unreliable on
- * drawn buttons. Rather than relying on it to generate
- * selection events, use the mouseUp event.
+ /*
+ * 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.XmNwidth, 0, OS.XmNheight, 0};
+ int [] argList = {OS.XmNx, 0, OS.XmNy, 0};
OS.XtGetValues (handle, argList, argList.length / 2);
- if (xEvent.x >= 0 && xEvent.y >= 0 && xEvent.x <= argList[1] && xEvent.y <= argList[3]) {
- processSelection(0);
- }
+ 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.state, xEvent);
- setDrawPressed(set);
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) {
+ 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 (xEvent.x > width - 12) event.detail = SWT.ARROW;
+ }
+ postEvent (SWT.Selection, event);
+ }
+ 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.XmNmarginWidth, 0, OS.XmNmarginHeight, 0};
+ int [] argList = {
+ OS.XmNcolormap, 0,
+ OS.XmNwidth, 0,
+ OS.XmNheight, 0,
+ };
OS.XtGetValues (handle, argList, argList.length / 2);
- int x = 0, y = 0, width = argList [3], height = argList [5], marginWidth = argList [7], marginHeight = argList [9];
+ 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;
@@ -710,54 +833,63 @@ int processPaint (int callData) {
gc.setClipping (rect);
}
- Image currentImage = drawHotImage ? hotImage : image;
- if (!getEnabled()) {
+ 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);
+ 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 != null && text.length() > 0) {
- Point textExtent = gc.textExtent(text);
+ if (text.length () != 0) {
+ Point textExtent = gc.textExtent (text);
textWidth = textExtent.x;
textHeight = textExtent.y;
}
int imageX = 0, imageY = 0, imageWidth = 0, imageHeight = 0;
if (currentImage != null) {
- Rectangle imageBounds = currentImage.getBounds();
+ Rectangle imageBounds = currentImage.getBounds ();
imageWidth = imageBounds.width;
imageHeight = imageBounds.height;
}
- if ((parent.style & SWT.RIGHT) > 0) {
- imageX = x + ((width - imageWidth - textWidth - marginWidth) / 2) + 1;
- imageY = y + ((height - imageHeight) / 2);
- textX = imageX + imageWidth + marginWidth;
- textY = y + ((height - textHeight) / 2);
+ 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 = x + ((width - imageWidth) / 2) + 1;
- imageY = y + ((height - imageHeight - textHeight - marginHeight) / 2) + 1;
- textX = x + ((width - textWidth) / 2) + 2;
- textY = imageY + imageHeight + marginHeight;
+ 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) gc.drawText(text, textX, textY, false);
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 (!getEnabled() && disabledImage == null) {
+ if (!enabled && disabledImage == null) {
if (currentImage != null) currentImage.dispose ();
}
return 0;
}
-
}
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
index 3f8db147f9..a185c1c35f 100755
--- 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
@@ -1,21 +1,28 @@
package org.eclipse.swt.widgets;
/*
-* Licensed Materials - Property of IBM,
-* SWT - The Simple Widget Toolkit,
-* (c) Copyright IBM Corp 1998, 1999.
-*/
-
-/* Imports */
+ * (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.*;
-/**
-*/
-
-/* Class Definition */
+/**
+ * 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 /*final*/ class Tracker extends Widget {
Composite parent;
Display display;
@@ -41,19 +48,25 @@ public Tracker (Display display, int style) {
this.style = style;
this.display = display;
}
-/**
-* 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
-*/
+/**
+ * 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);
@@ -61,6 +74,14 @@ public void addControlListener(ControlListener listener) {
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 () {
tracking = false;
}
@@ -105,12 +126,40 @@ void drawRectangles () {
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 () {
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 () {
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 () {
int xDisplay = display.xDisplay;
int color = OS.XWhitePixel (xDisplay, 0);
@@ -164,19 +213,23 @@ public boolean open () {
tracking = false;
return !cancelled;
}
-/**
-* 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
-*/
+/**
+ * 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);
@@ -184,9 +237,29 @@ public void removeControlListener (ControlListener listener) {
if (eventTable == null) return;
eventTable.unhook (SWT.Move, listener);
}
+/**
+ * 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) {
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) {
this.stippled = stippled;
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Tree.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Tree.java
index 463f425b91..44b79a37bf 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Tree.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Tree.java
@@ -1,19 +1,37 @@
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.*;
-
-/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
- */
-/**
- * Displays a hierarchy of items that can be selected.
- * Sub hierarchies can be expanded and collapsed.
+/**
+ * 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 /*final*/ class Tree extends SelectableItemWidget {
// These constants are used internally for item hit test on mouse click
@@ -39,9 +57,33 @@ public /*final*/ class Tree extends SelectableItemWidget {
// have it static. Initialized in c'tor and freed in dispose();
Rectangle hierarchyIndicatorRect = null; // bounding rectangle of the hierarchy indication image (plus/minus)
-/**
- * Create a new instance of the receiver with 'parent'
- * as its parent 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 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));
@@ -59,13 +101,32 @@ void addItem(TreeItem item, int index) {
}
getRoot().add(item, index);
}
-/**
-* Adds the listener to receive events.
-* <p>
-*
-* @param listener the 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.
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -78,13 +139,25 @@ public void addSelectionListener(SelectionListener listener) {
addListener(SWT.Selection, typedListener);
addListener(SWT.DefaultSelection, typedListener);
}
-/**
-* Adds the listener to receive events.
-* <p>
-*
-* @param listener the listener
-*
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -271,10 +344,6 @@ void collapseNoRedraw(TreeItem item) {
item.internalSetExpanded(false);
}
-/**
- * Answer the size of the receiver needed to display all or
- * the first 50 items whichever is less.
- */
public Point computeSize(int wHint, int hHint, boolean changed) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -313,8 +382,13 @@ public Point computeSize(int wHint, int hHint, boolean changed) {
}
return size;
}
-/**
- * Deselect all items of the receiver.
+/**
+ * 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() {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -554,8 +628,18 @@ int getIndex(SelectableItem item) {
}
return index;
}
-/**
- * Answer the number of root items.
+/**
+ * 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() {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -563,13 +647,16 @@ public int getItemCount() {
return getRoot().getItemCount();
}
-/**
- * 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.
+/**
+ * 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() {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -577,8 +664,22 @@ public int getItemHeight() {
return super.getItemHeight();
}
-/**
- * Answer the root items of the receiver as an Array.
+/**
+ * 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() {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -599,9 +700,17 @@ int getOffScreenItemCount(TreeItem item) {
return expandedItemCount - spaceRemaining;
}
-/**
- * Answer the parent item of the receiver.
- * This is null because the Tree widget does not have a parent item.
+/**
+ * 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() {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -615,10 +724,21 @@ public TreeItem getParentItem() {
TreeRoots getRoot() {
return root;
}
-/**
- * Answer the selected tree items.
- * @return an Array of DrawnTreeItems containing the selected items.
- * An empty Array if no items are selected.
+/**
+ * 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() {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -873,19 +993,16 @@ void mouseDoubleClick(Event event) {
TreeItem hitItem = getRoot().getVisibleItem(hitItemIndex + getTopIndex());
Event newEvent;
- if (hitItem == null) {
+ 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);
- return;
}
- if (hitItem.getItemCount() == 0) {
- return; // an item was hit but it does not have children
- }
- if (itemAction(hitItem, event.x, event.y) == ActionSelect) {
+ else
+ if (hitItem.isLeaf() == false) { // item with children was hit. Default behavior is expand/collapse item
if (hitItem.getExpanded() == true) {
collapse(hitItem, true);
}
@@ -1053,8 +1170,13 @@ boolean redrawParentItem(SelectableItem item) {
return redraw;
}
-/**
- * Remove all items of the receiver.
+/**
+ * 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() {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -1076,13 +1198,23 @@ public void removeAll() {
void removeItem(TreeItem item) {
getRoot().removeItem(item);
}
-/**
-* Removes the listener.
-* <p>
-*
-* @param listener the 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -1093,13 +1225,23 @@ public void removeSelectionListener(SelectionListener listener) {
removeListener (SWT.Selection, listener);
removeListener (SWT.DefaultSelection, listener);
}
-/**
-* Removes the listener.
-* <p>
-*
-* @param listener the 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -1142,7 +1284,7 @@ void removingItem(SelectableItem item) {
newSelectionItem = parentItem;
}
if (newSelectionItem != null) {
- selectNotify(newSelectionItem);
+ selectNotify(newSelectionItem, true);
}
}
super.removingItem(item);
@@ -1283,11 +1425,13 @@ void scrollVertical(int scrollIndexCount) {
0, scrollIndexCount * getItemHeight(), // source x, y
clientArea.width, clientArea.height, true);
}
-/**
- * Select all items of the receiver if it is in multiple
- * selection mode.
- * A SWT.Selection event will not be sent.
- * Do nothing if the receiver is in single selection mode.
+/**
+ * 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() {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -1306,10 +1450,6 @@ public void selectAll() {
void setExpandingItem(TreeItem item) {
expandingItem = item;
}
-/**
- * The font is changing. Reset and recalculate the item
- * height using all items of the receiver.
- */
public void setFont(Font font) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -1339,14 +1479,19 @@ public void setFont(Font font) {
}
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.
- * <p>
- * @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'.
+/**
+ * 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 SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the 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){
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -1354,11 +1499,22 @@ public void setInsertMark(TreeItem item, boolean before){
motif_setInsertMark(item, !before);
}
-/**
- * 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
+/**
+ * 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 Tree#deselectAll()
*/
public void setSelection(TreeItem selectionItems[]) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -1385,13 +1541,22 @@ void setTopIndex(int index, boolean adjustScrollbar) {
super.setTopIndex(index, adjustScrollbar);
calculateWidestScrolledItem(indexDiff);
}
-/**
- * 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.
+/**
+ * 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 listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -1419,10 +1584,21 @@ void showSelectableItem(SelectableItem item) {
}
super.showSelectableItem(item);
}
-/**
- * Return the item at the specified location in the widget.
- * Return null if there is no item at the specified location
- * or if the location is outside the widget client area.
+/**
+ * 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;
@@ -1444,8 +1620,15 @@ public TreeItem getItem(Point point) {
}
return hitItem;
}
-/**
- * Answer the number of selected items in the receiver.
+/**
+ * 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() {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -1453,11 +1636,20 @@ public int getSelectionCount() {
return super.getSelectionCount();
}
-/**
- * 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.
+/**
+ * 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() {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/TreeItem.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/TreeItem.java
index cb0aba6a89..e19494cdd0 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/TreeItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/TreeItem.java
@@ -1,22 +1,31 @@
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.*;
-
-/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
- */
-/**
- * This class represents leaf, non-leaf and root tree items.
- * leaf items don't have any children. non-leaf items have one
- * or more children.
- * Root items don't have a parent item. Root items are either
- * leaf or non-leaf items.
- *
- * This class caches geometrical data for drawing..
+/**
+ * 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 /*final*/ class TreeItem extends AbstractTreeItem {
+/*
+ * This class caches geometric data for drawing.
* A description of the cached data follows:
*
* | 1 || 5 |
@@ -50,9 +59,7 @@ import java.util.*;
* d = SELECTION_PADDING
* e = ITEM_NOIMAGE_OFFSET
* f = ITEM_CONNECTOR_PADDING;
-
*/
-public /*final*/ class TreeItem extends AbstractTreeItem {
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
@@ -173,26 +180,7 @@ static TreeItem checkNull(TreeItem item) {
protected void checkSubclass () {
if (!isValidSubclass ()) error (SWT.ERROR_INVALID_SUBCLASS);
}
-/**
- * Notify the parent that the receiver is being removed.
- * Reset cached data.
- */
-void doDispose() {
- TreeItem parentItem = getParentItem();
-
- if (parentItem != null) {
- parentItem.removeItem(this);
- }
- else {
- getParent().removeItem(this);
- }
- setParentItem(null);
- setImageExtent(null);
- setItemExtent(null);
- setIndex(-1);
- setPaintStartX(-1);
- setTextYPosition(-1);
-}
+
/**
* Draw the hierarchy indicator at 'position'.
*
@@ -419,17 +407,16 @@ Point drawVerticalItemConnector(GC gc, Point position) {
return position;
}
-/**
- * Gets the widget bounds.
- * The widget bounds is the rectangle around the item text. It is
- * the same as the selection rectangle.
- * <p>
- * @return a rectangle that is the widget bounds.
- *
- * @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>
+/**
+ * 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);
@@ -520,8 +507,16 @@ int getItemConnectorWidth() {
}
return itemConnectorWidth;
}
-/**
- * Return the number of children.
+/**
+ * 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() {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -565,8 +560,21 @@ int getItemStartX() {
}
return itemStartX;
}
-/**
- * Answer the child items of the receiver as an Array.
+/**
+ * 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() {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -613,8 +621,15 @@ int getPaintStartX() {
int getPaintStopX() {
return (getItemStartX() + getItemExtent().x - getParent().getHorizontalOffset());
}
-/**
- * Answer the parent widget of the receiver.
+/**
+ * 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() {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -622,9 +637,17 @@ public Tree getParent() {
return (Tree) super.getSelectableParent();
}
-/**
- * Answer the parent item of the receiver or null if the
- * receiver is a root.
+/**
+ * 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() {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -947,14 +970,16 @@ void reset() {
setPaintStartX(-1);
setTextYPosition(-1);
}
-/**
- * Set whether the receiver is expanded or not.
- * If the receiver is expanded its child items are visible.
- * @param expand -
- * true=the receiver will be expanded, making its child items
- * visible.
- * false=the receiver will be collapsed, making its child items
- * invisible
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -967,10 +992,6 @@ public void setExpanded(boolean expand) {
getParent().collapse(this, false);
}
}
-/**
- * Set the image of the receiver to 'newImage'.
- * Reset cached data and notify the parent if the image has changed.
- */
public void setImage(Image newImage) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -1035,13 +1056,10 @@ void setPaintStartX(int startX) {
void setParentItem(TreeItem parentItem) {
this.parentItem = parentItem;
}
-/**
- * Set the label text of the receiver to 'string'.
- * Reset cached data and notify the parent if the text has
- * changed.
- * 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.
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -1069,24 +1087,50 @@ public void setText(String newText) {
void setTextYPosition(int yPosition) {
textYPosition = yPosition;
}
-/**
- * Destroy all children of the receiver
- * Collapsing the item speeds up deleting the children.
- */
-void disposeItem() {
- Tree parent = getParent();
-
+
+public void dispose() {
+ if (!isValidWidget ()) 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.disposeItem();
+
+ super.dispose();
}
-/**
- * Return whether or not the receiver is checked.
- * Always return false if the parent of the receiver does not
- * have the CHECK style.
+
+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() {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -1094,21 +1138,21 @@ public boolean getChecked() {
return super.getChecked();
}
-/**
- * Answer the display of the receiver's parent widget.
- */
public Display getDisplay() {
return super.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>
+/**
+ * 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() {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -1116,9 +1160,16 @@ public boolean getGrayed() {
return super.getGrayed();
}
-/**
- * Set the checked state to 'checked' if the parent of the
- * receiver has the CHECK style.
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -1126,15 +1177,16 @@ public void setChecked(boolean checked) {
super.setChecked(checked);
}
-/**
- * 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>
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/TreeRoots.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/TreeRoots.java
index c9e4dea7ab..dec4c31435 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/TreeRoots.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/TreeRoots.java
@@ -1,13 +1,13 @@
package org.eclipse.swt.widgets;
-import org.eclipse.swt.graphics.*;
-import java.util.*;
-
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
+import org.eclipse.swt.graphics.*;
+import java.util.*;
+
/**
* This class is used to store tree root items.
* Instances of this class are never displayed.
@@ -41,16 +41,15 @@ void calculateVisibleItemCount() {
* of this item.
*/
void calculateVisibleItemCountParent() {}
-/**
- * Destroy all children of the receiver
- */
-void disposeItem() {
+
+public void dispose() {
+ if (!isValidWidget ()) 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.disposeItem();
+ super.dispose();
parent.setRemovingAll(false);
}
/**
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
index 6aaaa08b44..d3c445d4f8 100755
--- 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
@@ -1,16 +1,10 @@
package org.eclipse.swt.widgets;
/*
-* Licensed Materials - Property of IBM,
-* SWT - The Simple Widget Toolkit,
-* (c) Copyright IBM Corp 1998, 1999.
-*/
-
-/**
-* See JavaDoc for Windows.
-*/
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
-/* Imports */
import org.eclipse.swt.internal.*;
import org.eclipse.swt.internal.motif.*;
import org.eclipse.swt.*;
@@ -18,7 +12,32 @@ import org.eclipse.swt.graphics.*;
import org.eclipse.swt.events.*;
import java.util.EventListener;
-/* Class Definition */
+/**
+ * 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;
@@ -73,42 +92,59 @@ public abstract class Widget {
Widget () {
/* Do nothing */
}
-/**
-* Creates a widget.
-* <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(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_ERROR_NULL_ARGUMENT)
-* when the parent is 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 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 a listener for an event.
-* <p>
-* This method adds a listener for an event. When the
-* event occurs in the widget, the listener is notified
-* using <code>handleEvent ()</code>.
-*
-* @param eventType the desired SWT event
-* @param handler the event handler
-*
-* @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 handler is null
-*/
+/**
+ * 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);
@@ -116,19 +152,25 @@ public void addListener (int eventType, Listener handler) {
if (eventTable == null) eventTable = new EventTable ();
eventTable.hook (eventType, handler);
}
-/**
-* 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
-*/
+/**
+ * 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);
@@ -218,18 +260,29 @@ void destroyWidget () {
OS.XtDestroyWidget (topHandle);
}
}
-/**
-* Disposes a widget.
-* <p>
-* This method destroys the widget and all children
-* and releases all platform resources associated with
-* the widget tree.
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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
@@ -244,37 +297,57 @@ public void dispose () {
void error (int code) {
SWT.error(code);
}
-/**
-* Gets the widget data.
-* <p>
-* This method gets the application defined data that
-* is associated with the widget.
-*
-* @return the widget data
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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;
}
-/**
- * Searches for the property with the specified name.
- * If the property is not found, null is returned.
- *
- * @param key the name of the property to find
- * @return the named property value
- *
- * @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>
+/**
+ * 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);
@@ -287,19 +360,22 @@ public Object getData (String key) {
return null;
}
-/**
-* Gets the Display.
-* <p>
-* This method gets the Display that is associated
-* with the widget.
-*
-* @return the widget data
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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 ();
@@ -310,18 +386,26 @@ String getName () {
String getNameText () {
return "";
}
-/**
-* Gets the widget style.
-* <p>
-* This method gets the widget style bits.
-*
-* @return an integer that is the widget style bits.
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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);
@@ -334,18 +418,17 @@ boolean hooks (int eventType) {
if (eventTable == null) return false;
return eventTable.hooks (eventType);
}
-/**
-* Gets the disposed state.
-* <p>
-* This method gets the dispose state for the widget.
-* When a widget has been disposed, it is an error to
-* to invoke any other method on the widget.
-*
-* @return true when the widget is disposed
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-*/
+/**
+ * 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;
@@ -401,22 +484,22 @@ char mbcsToWcs (char ch) {
if (result.length == 0) return 0;
return result [0];
}
-/**
-* 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(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 handler is null
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -548,23 +631,24 @@ void releaseWidget () {
keys = null;
values = null;
}
-/**
-* Removes a listener for an event.
-* <p>
-* This method removes a listener for an event. When the
-* event occurs in the widget, the listener is no longer
-* notified.
-*
-* @param eventType the desired SWT event
-* @param handler the event handler
-*
-* @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 handler is 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);
@@ -582,19 +666,23 @@ protected void removeListener (int eventType, EventListener handler) {
if (eventTable == null) return;
eventTable.unhook (eventType, handler);
}
-/**
-* 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
-*/
+/**
+ * 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);
@@ -616,38 +704,55 @@ void sendEvent (int eventType, Event event) {
}
eventTable.sendEvent (event);
}
-/**
-* Sets the widget data.
-* <p>
-* This method sets the application defined data that
-* is associated with the widget.
-*
-* @param the widget data
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
this.data = data;
}
-/**
- * Maps the specified key to the specified value.
- * If the key already exists, the old value is replaced.
- * The key cannot be null.
- *
- * @param key the name of the property
- * @param value the value of the property
- *
- * @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>
+/**
+ * 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);
@@ -698,9 +803,12 @@ public void setData (String key, Object value) {
values = newValues;
}
-/**
-* Returns a string representation of the object.
-*/
+/**
+ * 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 ()) {
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
index e0858ec93b..19073205ad 100755
--- 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
@@ -1,12 +1,12 @@
package org.eclipse.swt.widgets;
-import org.eclipse.swt.internal.motif.*;
-
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (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;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/library/build.sh b/bundles/org.eclipse.swt/Eclipse SWT/photon/library/build.sh
index 51c583add4..0f578be9a5 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/library/build.sh
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/library/build.sh
@@ -1,6 +1,7 @@
- #!/bin/sh
-# (c) Copyright IBM Corp 1999, 2000
-#
+#!/bin/sh
+
+# (c) Copyright IBM Corp., 2000, 2001
+# All Rights Reserved.
export IVE_HOME=~/ive/bin
export PATH=$IVE_HOME:$PATH
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/library/library.c b/bundles/org.eclipse.swt/Eclipse SWT/photon/library/library.c
index 8f539152ab..49ea3d05f4 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/library/library.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/library/library.c
@@ -1,3 +1,8 @@
+/*
+ * (c) Copyright IBM Corp., 2000, 2001
+ * All Rights Reserved.
+ */
+
/**
* library.c
*
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/library/makefile.mak b/bundles/org.eclipse.swt/Eclipse SWT/photon/library/makefile.mak
index 049e3c3f4e..f688b0be28 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/library/makefile.mak
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/library/makefile.mak
@@ -1,7 +1,10 @@
- # Makefile for module 'swt'
+# Makefile for module 'swt'
+
+# (c) Copyright IBM Corp., 2000, 2001
+# All Rights Reserved.
maj_ver=0
-min_ver=104
+min_ver=125
revision=0
#assumes IVE_HOME is set in the environment
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/library/structs.c b/bundles/org.eclipse.swt/Eclipse SWT/photon/library/structs.c
index 375f7e22e0..51f3781910 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/library/structs.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/library/structs.c
@@ -1,3 +1,8 @@
+/*
+ * (c) Copyright IBM Corp., 2000, 2001
+ * All Rights Reserved.
+ */
+
/**
* JNI SWT object field getters and setters declarations for Motif structs.
*/
@@ -1088,4 +1093,112 @@ void setPhRegion_tFields(JNIEnv *env, jobject lpObject, PhRegion_t *lpStruct, PP
(*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);
+}
+
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/library/structs.h b/bundles/org.eclipse.swt/Eclipse SWT/photon/library/structs.h
index dcc5e20c1b..38be26ebdc 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/library/structs.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/library/structs.h
@@ -1,3 +1,8 @@
+/*
+ * (c) Copyright IBM Corp., 2000, 2001
+ * All Rights Reserved.
+ */
+
/**
* JNI SWT object field getters and setters declarations for Photon structs
*/
@@ -32,7 +37,9 @@
PtTreeItem_t_FID_CACHE PtTreeItem_tFc; \
PgMap_t_FID_CACHE PgMap_tFc; \
PtColorSelectInfo_t_FID_CACHE PtColorSelectInfo_tFc; \
- PhRegion_t_FID_CACHE PhRegion_tFc;
+ PhRegion_t_FID_CACHE PhRegion_tFc; \
+ PtContainerCallback_t_FID_CACHE PtContainerCallback_tFc; \
+ PhCursorDef_t_FID_CACHE PhCursorDef_tFc;
/* PhPoint_t struct */
typedef struct PhPoint_t_FID_CACHE {
@@ -295,4 +302,28 @@ void cachePhRegion_tFids(JNIEnv *env, jobject lpObject, PPhRegion_t_FID_CACHE lp
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);
+
#endif // INC_structs_H
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/library/swt.c b/bundles/org.eclipse.swt/Eclipse SWT/photon/library/swt.c
index dedefe1af2..8dbd9a0ed3 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/library/swt.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/library/swt.c
@@ -1,3 +1,8 @@
+/*
+ * (c) Copyright IBM Corp., 2000, 2001
+ * All Rights Reserved.
+ */
+
/**
* SWT OS natives implementation.
*/
@@ -950,7 +955,22 @@ JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PhEventPeek
#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
@@ -1436,7 +1456,7 @@ JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PgDrawText
/*
* Class: org_eclipse_swt_internal_photon_OS
* Method: PgDrawText
- * Signature: ([CISSI)I
+ * 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)
@@ -1465,6 +1485,39 @@ JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PgDrawText
/*
* 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
*/
@@ -1874,7 +1927,6 @@ JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtFlush
return (jint)PtFlush();
}
-
/*
* Class: org_eclipse_swt_internal_photon_OS
* Method: PtContainerGiveFocus
@@ -1905,6 +1957,174 @@ JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtContainerGiveFo
/*
* 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
*/
@@ -2090,18 +2310,67 @@ JNIEXPORT jobject JNICALL Java_org_eclipse_swt_internal_photon_OS_PfExtentWideTe
/*
* 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
- (JNIEnv *env, jobject that, jobject extent, jobject pos, jbyteArray font, jbyteArray str, jint len)
+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 *font1=NULL;
jbyte *str1=NULL;
+ jbyte *font1=NULL;
PhRect_t * result;
#ifdef DEBUG_CALL_PRINTS
@@ -2138,15 +2407,14 @@ JNIEXPORT jobject JNICALL Java_org_eclipse_swt_internal_photon_OS_PfExtentText
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;
+ * 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
- (JNIEnv *env, jobject that, jobject extent, jobject pos, int font, int str, jint len)
+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;
@@ -3180,7 +3448,6 @@ JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtWidgetClass
* 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)
{
@@ -3198,7 +3465,6 @@ JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_memmove__ILorg_ec
}
memmove((void *)dest, (void *)src1, count);
}
-*/
/*
* Class: org_eclipse_swt_internal_photon_OS
@@ -3278,6 +3544,29 @@ JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_memmove__Lorg_ecl
/*
* 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
*/
@@ -5365,7 +5654,6 @@ JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtColorPalette
* Method: PtGroup
* Signature: ()I
*/
-/*
JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtGroup
(JNIEnv *env, jobject that)
{
@@ -5375,7 +5663,6 @@ JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtGroup
return (jint)PtGroup;
}
-*/
/*
* Class: org_eclipse_swt_internal_photon_OS
@@ -5893,4 +6180,168 @@ JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PiGetPixelRGB
return result;
}
-*/ \ No newline at end of file
+*/
+
+/*
+ * 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;
+}
+
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
index f737dbd2df..9d8ad52bda 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.graphics;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.*;
@@ -54,18 +54,22 @@ public boolean equals (Object object) {
}
public int getBlue () {
+ if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
return handle & 0xFF;
}
public int getGreen () {
+ if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
return (handle & 0xFF00) >> 8;
}
public int getRed () {
+ if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
return (handle & 0xFF0000) >> 16;
}
public RGB getRGB () {
+ if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
return new RGB((handle & 0xFF0000) >> 16, (handle & 0xFF00) >> 8, handle & 0xFF);
}
@@ -86,6 +90,7 @@ public boolean isDisposed() {
}
public String toString () {
+ if (isDisposed()) return "Color {*DISPOSED*}";
return "Color {" + getRed() + ", " + getGreen() + ", " + getBlue() + "}";
}
@@ -96,4 +101,4 @@ public static Color photon_new(Device device, int handle) {
color.device = device;
return color;
}
-} \ No newline at end of file
+}
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
index dae177eaca..4f5386b0e5 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.graphics;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.photon.*;
@@ -20,7 +20,7 @@ public final class Cursor {
* the handle to the OS cursor resource
* (Warning: This field is platform dependent)
*/
- public int handle;
+ public int bitmap;
/**
* the device where this cursor was created
@@ -60,8 +60,7 @@ public Cursor(Device device, int style) {
default:
SWT.error(SWT.ERROR_INVALID_ARGUMENT);
}
- handle = type;
- if (handle == 0) SWT.error(SWT.ERROR_NO_HANDLES);
+ if (type == 0) SWT.error(SWT.ERROR_NO_HANDLES);
if (device.tracking) device.new_Object(this);
}
@@ -69,18 +68,91 @@ public Cursor(Device device, ImageData source, ImageData mask, int hotspotX, int
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;
- SWT.error(SWT.ERROR_NOT_IMPLEMENTED);
- if (handle == 0) SWT.error(SWT.ERROR_NO_HANDLES);
+
+ 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);
}
public void dispose () {
- if (handle == 0) return;
- if (type == OS.Ph_CURSOR_BITMAP && handle != 0) {
- /* BITMAP cursors are not implemented yet */
+ if (type == 0) return;
+ if (type == OS.Ph_CURSOR_BITMAP && bitmap != 0) {
+ OS.free(bitmap);
}
- type = handle = 0;
+ type = bitmap = 0;
if (device.tracking) device.dispose_Object(this);
device = null;
}
@@ -89,24 +161,30 @@ 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;
+ return device == cursor.device && type == cursor.type &&
+ bitmap == cursor.bitmap;
}
public int hashCode () {
- return handle ^ type;
+ return bitmap ^ type;
}
public boolean isDisposed() {
return type == 0;
}
-public static Cursor photon_new(Device device, int type, int handle) {
+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.handle = handle;
+ cursor.bitmap = bitmap;
cursor.device = device;
return cursor;
}
-} \ No newline at end of file
+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
index 3d48ea467a..ff740b3b53 100755
--- 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
@@ -1,5 +1,10 @@
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.*;
@@ -14,37 +19,47 @@ public abstract class Device implements Drawable {
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;
+}
public Device(DeviceData data) {
- create (data);
- init ();
if (data != null) {
debug = data.debug;
tracking = data.tracking;
}
+ create (data);
+ init ();
if (tracking) {
errors = new Error [128];
objects = new Object [128];
}
}
-/**
- * Temporary code.
- */
-static Device getDevice () {
- Device device = null;
- try {
- Class clazz = Class.forName ("org.eclipse.swt.widgets.Display");
- java.lang.reflect.Method method = clazz.getMethod("getCurrent", new Class[0]);
- device = (Device) method.invoke(clazz, new Object[0]);
- if (device == null) {
- method = clazz.getMethod("getDefault", new Class[0]);
- device = (Device)method.invoke(clazz, new Object[0]);
- }
- } catch (Throwable e) {};
- return device;
-}
-
protected void checkDevice () {
if (disposed) SWT.error(SWT.ERROR_DEVICE_DISPOSED);
}
@@ -250,4 +265,4 @@ public void setWarnings (boolean warnings) {
checkDevice ();
}
-} \ No newline at end of file
+}
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
index f971a60537..27fe10271d 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.graphics;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class DeviceData {
@@ -14,4 +14,4 @@ public class DeviceData {
public boolean tracking;
public Error [] errors;
public Object [] objects;
-} \ No newline at end of file
+}
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
index de23742eed..433ccb07b1 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.graphics;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.*;
@@ -66,6 +66,7 @@ public boolean equals(Object object) {
}
public FontData[] getFontData() {
+ if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
return new FontData[]{new FontData(handle)};
}
@@ -104,4 +105,9 @@ public static Font photon_new(Device device, byte[] stem) {
return font;
}
-} \ No newline at end of file
+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
index b7e0fe27ce..fd9902bd2b 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.graphics;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.*;
@@ -185,4 +185,4 @@ public static FontData photon_new(byte[] stem) {
return new FontData(stem);
}
-} \ No newline at end of file
+}
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
index 6943cd42d9..fa6ba3fb21 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.graphics;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.photon.*;
@@ -47,6 +47,7 @@ public int getAscent() {
}
public int getAverageCharWidth() {
+ if ((handle.style & OS.PHFONT_INFO_FIXED) != 0) return handle.width;
return handle.width / 2;
}
@@ -75,4 +76,4 @@ public static FontMetrics photon_new(FontQueryInfo handle) {
fontMetrics.handle = handle;
return fontMetrics;
}
-} \ No newline at end of file
+}
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
index 9c79ad0715..27bfe18b80 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.graphics;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.*;
@@ -52,8 +52,9 @@ public GC(Drawable drawable) {
}
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) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+ if (image.type != SWT.BITMAP || image.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
int flags = OS.PtEnter(0);
try {
Rectangle bounds = image.getBounds();
@@ -111,6 +112,7 @@ public void copyArea(Image image, int x, int y) {
}
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;
@@ -195,14 +197,23 @@ public void copyArea(int x, int y, int width, int height, int destX, int destY)
delta.x = (short)deltaX;
delta.y = (short)deltaY;
int clipRects = data.clipRects;
- if (clipRects == 0) {
+ 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);
- int clip = OS.PhRectsToTiles(clipRects, data.clipRectsCount);
- int dest_tiles = OS.PhIntersectTilings(dest, clip, new short[1]);
+ 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();
@@ -276,6 +287,7 @@ public void dispose() {
}
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 (startAngle > 0) {
if (endAngle > 0) {
//No need to modify start angle.
@@ -336,27 +348,32 @@ public void drawArc (int x, int y, int width, int height, int startAngle, int en
}
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);
}
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);
}
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;
- if (drawImage == 0) return;
PhImage_t phDrawImage = new PhImage_t();
OS.memmove(phDrawImage, drawImage, PhImage_t.sizeof);
int imgWidth = phDrawImage.size_w;
@@ -683,6 +700,7 @@ static int scaleImage(Image image, PhImage_t phImage, int srcX, int srcY, int sr
}
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();
@@ -695,6 +713,7 @@ public void drawLine (int x1, int y1, int x2, int y2) {
}
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();
@@ -713,6 +732,7 @@ public void drawOval (int x, int y, int width, int height) {
}
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];
@@ -732,20 +752,19 @@ public void drawPolygon(int[] pointArray) {
}
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];
}
- PhPoint_t pos = new PhPoint_t();
- pos.x = 0; pos.y = 0;
int flags = OS.PtEnter(0);
try {
int prevContext = setGC();
setGCClipping();
- OS.PgDrawPolygon(points, pointArray.length / 2, pos, OS.Pg_DRAW_STROKE);
+ OS.PgDrawPolygon(points, pointArray.length / 2, new PhPoint_t(), OS.Pg_DRAW_STROKE);
unsetGC(prevContext);
} finally {
if (flags >= 0) OS.PtLeave(flags);
@@ -753,6 +772,7 @@ public void drawPolyline(int[] pointArray) {
}
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();
@@ -771,6 +791,7 @@ public void drawRectangle (Rectangle rect) {
}
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
@@ -794,6 +815,7 @@ public void drawString (String string, int x, int y) {
}
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;
@@ -816,7 +838,28 @@ public void drawText (String string, int x, int y) {
}
public void drawText (String string, int x, int y, boolean isTransparent) {
- drawString(string, x, y, 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();
+ rect.ul_x = (short)x;
+ rect.ul_y = (short)y;
+ rect.lr_x = (short)0xFFFF;
+ rect.lr_y = (short)0xFFFF;
+
+ int flags = OS.PtEnter(0);
+ try {
+ int prevContext = setGC();
+ setGCClipping();
+ 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);
+ }
}
public boolean equals (Object object) {
@@ -824,6 +867,7 @@ public boolean equals (Object object) {
}
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 (startAngle > 0) {
if (endAngle > 0) {
//No need to modify start angle.
@@ -884,6 +928,7 @@ public void fillArc (int x, int y, int width, int height, int startAngle, int en
}
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();
@@ -904,6 +949,7 @@ public void fillOval (int x, int y, int width, int height) {
}
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];
@@ -923,6 +969,7 @@ public void fillPolygon(int[] pointArray) {
}
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 {
@@ -941,6 +988,7 @@ public void fillRectangle (Rectangle rect) {
}
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);
@@ -963,16 +1011,19 @@ public int getAdvanceWidth(char ch) {
}
public Color getBackground() {
+ if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
return Color.photon_new(data.device, data.background);
}
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;
}
public Rectangle getClipping() {
+ if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
int flags = OS.PtEnter(0);
try {
PhRect_t rect = new PhRect_t();
@@ -1014,6 +1065,7 @@ public Rectangle getClipping() {
}
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 {
@@ -1047,28 +1099,34 @@ public void getClipping (Region region) {
}
public Font getFont () {
+ if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
return Font.photon_new(data.device, data.font);
}
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);
}
public Color getForeground() {
+ if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
return Color.photon_new(data.device, data.foreground);
}
public int getLineStyle() {
+ if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
return data.lineStyle;
}
public int getLineWidth() {
+ if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
return data.lineWidth;
}
public boolean getXORMode() {
+ if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
return data.xorMode;
}
@@ -1076,7 +1134,6 @@ public int hashCode () {
return handle;
}
-
void init(Drawable drawable, GCData data, int context) {
int prevContext;
Image image = data.image;
@@ -1123,6 +1180,7 @@ void init(Drawable drawable, GCData data, int context) {
}
public boolean isClipped() {
+ if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
return data.clipRects != 0;
}
@@ -1130,13 +1188,34 @@ 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();
+}
+
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();
- int backColor = color == null ? DefaultBack : color.handle;
- OS.PgSetFillColor(backColor);
- data.background = backColor;
+ OS.PgSetFillColor(data.background = color.handle);
unsetGC(prevContext);
} finally {
if (flags >= 0) OS.PtLeave(flags);
@@ -1144,6 +1223,7 @@ public void setBackground (Color color) {
}
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;
@@ -1168,6 +1248,7 @@ public void setClipping (int x, int y, int width, int height) {
}
public void setClipping (Rectangle rect) {
+ if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
if (rect == null) {
int flags = OS.PtEnter(0);
try {
@@ -1186,6 +1267,7 @@ public void setClipping (Rectangle rect) {
}
public void setClipping (Region region) {
+ if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
int flags = OS.PtEnter(0);
try {
int clipRects = data.clipRects;
@@ -1213,6 +1295,8 @@ public void setClipping (Region region) {
}
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();
@@ -1226,11 +1310,13 @@ public void setFont (Font font) {
}
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 = color == null ? DefaultFore : color.handle;
- data.foreground = foreColor;
+ int foreColor = data.foreground = color.handle;
OS.PgSetStrokeColor(foreColor);
OS.PgSetTextColor(foreColor);
unsetGC(prevContext);
@@ -1240,6 +1326,7 @@ public void setForeground (Color color) {
}
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;
@@ -1263,6 +1350,7 @@ public void setLineStyle(int lineStyle) {
}
public void setLineWidth(int lineWidth) {
+ if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
int flags = OS.PtEnter(0);
try {
int prevContext = setGC();
@@ -1294,63 +1382,70 @@ void setGCClipping() {
if (widget == 0) return;
+ int clip_tile = getClipping(widget, topWidget, true, true);
+ int[] clip_rects_count = new int[1];
+ int clip_rects = OS.PhTilesToRects(clip_tile, clip_rects_count);
+ OS.PhFreeTiles(clip_tile);
+
+ /* PgSetClipping sets the clipping to the full region when the count is zero */
+ 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
- // Get the rectangle of all siblings in front of the widget
- 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
+ /* Get the rectangle of all siblings in front of the widget */
+ if (clipSiblings) {
+ 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
+ }
}
+ /* 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
}
- // 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
- 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
+ /* 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
+ }
+ temp_widget = OS.PtWidgetBrotherInFront(temp_widget);
}
- temp_widget = OS.PtWidgetBrotherInFront(temp_widget);
}
- // Get the widget's rectangle
+ /* 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
- int clip_rects;
- int[] clip_rects_count = new int[1];
+ /* 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);
- clip_rects = OS.PhTilesToRects(clip_tile, clip_rects_count);
OS.PhFreeTiles(child_tile);
- OS.PhFreeTiles(clip_tile);
- } else {
- clip_rects = OS.PhTilesToRects(widget_tile, clip_rects_count);
- OS.PhFreeTiles(widget_tile);
- }
-
- // PgSetClipping sets the clipping to the full region when the count is zero
- if (clip_rects_count[0] == 0) {
- clip_rects_count[0] = 1;
- OS.free(clip_rects);
- clip_rects = OS.malloc(PhRect_t.sizeof);
+ return clip_tile;
}
- OS.PgSetClipping((short)clip_rects_count[0], clip_rects);
- OS.free(clip_rects);
+ return widget_tile;
}
public void setXORMode(boolean xor) {
+ if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
int flags = OS.PtEnter(0);
try {
int prevContext = setGC();
@@ -1364,6 +1459,7 @@ public void setXORMode(boolean xor) {
}
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();
@@ -1377,13 +1473,40 @@ public Point stringExtent(String string) {
if (flags >= 0) OS.PtLeave(flags);
}
- int width = rect.lr_x - rect.ul_x + 1;
+ 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);
}
public Point textExtent(String string) {
- return stringExtent(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);
+}
+
+public String toString () {
+ if (isDisposed()) return "GC {*DISPOSED*}";
+ return "GC {" + handle + "}";
}
void unsetGC(int prevContext) {
@@ -1404,4 +1527,4 @@ public static GC photon_new(Drawable drawable, GCData data) {
return gc;
}
-} \ No newline at end of file
+}
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
index f021841ba1..389600ec87 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.graphics;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.*;
@@ -20,4 +20,4 @@ public final class GCData {
public int lineWidth = 1;
public int clipRectsCount;
public int clipRects;
-} \ No newline at end of file
+}
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
index 01f00d8053..2dc3f904a3 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.graphics;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.photon.*;
@@ -61,6 +61,7 @@ public Image(Device device, Image srcImage, int flag) {
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:
@@ -238,6 +239,7 @@ public boolean equals (Object object) {
}
public Color getBackground() {
+ if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
if (transparentPixel == -1) return null;
PhImage_t phImage = new PhImage_t();
@@ -274,13 +276,14 @@ public Color getBackground() {
}
public Rectangle getBounds() {
- if (handle == 0) return new Rectangle(0, 0, 0, 0);
+ 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);
}
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;
@@ -580,8 +583,11 @@ public boolean isDisposed() {
}
public void setBackground(Color color) {
+ if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
if (color == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (transparentPixel == -1) return;
+ 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;
@@ -609,4 +615,9 @@ public static Image photon_new(Device device, int type, int handle) {
return image;
}
-} \ No newline at end of file
+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
index 2b058dfc7c..dda73e3f79 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.graphics;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.photon.*;
@@ -27,6 +27,7 @@ Region(int handle) {
public void add (Rectangle rect) {
+ if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
if (rect == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
if (handle == 0) return;
int tile_ptr = OS.PhGetTile();
@@ -41,6 +42,7 @@ public void add (Rectangle rect) {
}
public void add (Region region) {
+ if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
if (region == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
if (handle == 0) return;
if (region.handle == 0 || region.handle == EMPTY_REGION) return;
@@ -50,6 +52,7 @@ public void add (Region region) {
}
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();
@@ -82,6 +85,7 @@ public boolean equals (Object object) {
}
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;
@@ -105,6 +109,7 @@ public int hashCode () {
}
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();
@@ -137,17 +142,9 @@ public boolean isEmpty () {
public static Region photon_new(int handle) {
return new Region(handle);
}
-/*
-public static void printTile(int tile_ptr, String msg) {
- if (tile_ptr == 0) return;
- PhTile_t tile = new PhTile_t();
- int temp_tile = tile_ptr;
- int count = 0;
- do {
- OS.memmove(tile, temp_tile, PhTile_t.sizeof);
- System.out.println(msg + "-" + count++ + " address=" + temp_tile + " x1=" + tile.rect_ul_x + " y1=" + tile.rect_ul_y + " x2=" + tile.rect_lr_x + " y2=" + tile.rect_lr_y);
- temp_tile = tile.next;
- } while (temp_tile != 0);
+
+public String toString () {
+ if (isDisposed()) return "Region {*DISPOSED*}";
+ return "Region {" + handle + "}";
}
-*/
-} \ No newline at end of file
+}
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
index 682f69081f..f9c66b8274 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.internal;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public final class Converter {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/FontDetails.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/FontDetails.java
index adcae07101..04879a4ab9 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/FontDetails.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/FontDetails.java
@@ -1,8 +1,8 @@
package org.eclipse.swt.internal.photon;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class FontDetails {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/FontQueryInfo.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/FontQueryInfo.java
index af0556407a..90cf14d8d8 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/FontQueryInfo.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/FontQueryInfo.java
@@ -1,8 +1,8 @@
package org.eclipse.swt.internal.photon;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class FontQueryInfo {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/OS.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/OS.java
index 0ecedcc7b1..2c83686a4f 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/OS.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/OS.java
@@ -1,8 +1,8 @@
package org.eclipse.swt.internal.photon;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.*;
@@ -34,10 +34,10 @@ public class OS {
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_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;
@@ -156,16 +156,26 @@ public class OS {
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_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};
/*** END MANUALLY ADDED/FIXED ***/
//public static final int Aw_ARG_ONOFF_STATE = ( 5 * 1000 + 1 );
@@ -652,7 +662,7 @@ public static final int Pg_BITMAP_TRANSPARENT =
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_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;
@@ -673,7 +683,7 @@ public static final int Pg_BITMAP_TRANSPARENT =
//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_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;
@@ -724,9 +734,9 @@ public static final int Pg_BITMAP_TRANSPARENT =
//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_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_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;
@@ -755,10 +765,10 @@ public static final int Pg_BITMAP_TRANSPARENT =
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_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_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;
@@ -768,7 +778,7 @@ public static final int Pg_BITMAP_TRANSPARENT =
//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_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;
@@ -795,7 +805,7 @@ public static final int Pg_BITMAP_TRANSPARENT =
//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_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;
@@ -803,7 +813,7 @@ public static final int Pg_BITMAP_TRANSPARENT =
//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_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;
@@ -900,7 +910,7 @@ public static final int Pg_BITMAP_TRANSPARENT =
//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_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;
@@ -1049,7 +1059,7 @@ public static final int Pg_BITMAP_TRANSPARENT =
//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_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;
@@ -1190,7 +1200,7 @@ public static final int Pg_BITMAP_TRANSPARENT =
//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_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;
@@ -1290,8 +1300,8 @@ public static final int Pg_BITMAP_TRANSPARENT =
//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_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 );
@@ -1301,7 +1311,7 @@ public static final int Pg_BITMAP_TRANSPARENT =
//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_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 );
@@ -1382,7 +1392,7 @@ public static final int Pg_BITMAP_TRANSPARENT =
//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_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 );
@@ -1434,7 +1444,7 @@ public static final int Pg_BITMAP_TRANSPARENT =
//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_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 );
@@ -1503,7 +1513,7 @@ public static final int Pg_BITMAP_TRANSPARENT =
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_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 );
@@ -1517,7 +1527,7 @@ public static final int Pg_BITMAP_TRANSPARENT =
//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_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 );
@@ -1572,7 +1582,7 @@ public static final int Pg_BITMAP_TRANSPARENT =
//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_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 );
@@ -1745,7 +1755,7 @@ public static final int Pg_BITMAP_TRANSPARENT =
//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_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 );
@@ -1851,7 +1861,7 @@ public static final int Pg_BITMAP_TRANSPARENT =
//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_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);
@@ -1986,8 +1996,8 @@ public static final int Pg_BITMAP_TRANSPARENT =
//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_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;
@@ -2064,9 +2074,9 @@ public static final int Pg_BITMAP_TRANSPARENT =
//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_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_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;
@@ -2202,7 +2212,7 @@ public static final int Pg_BITMAP_TRANSPARENT =
//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_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;
@@ -2389,7 +2399,7 @@ public static final int Pg_BITMAP_TRANSPARENT =
//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 = 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;
@@ -2524,6 +2534,7 @@ public static final int MAX_FONT_TAG
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);
@@ -2533,6 +2544,8 @@ public static final native byte[] PfGenerateFontName(byte[] pkucDescription, int
//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);
@@ -2543,6 +2556,7 @@ 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);
@@ -2569,6 +2583,7 @@ public static final native int PtClippedBlit (int widget, int src, PhPoint_t del
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);
@@ -2654,6 +2669,12 @@ 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);
@@ -2717,7 +2738,7 @@ 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, PhImage_t image, 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);
@@ -2725,6 +2746,7 @@ 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);
@@ -2852,7 +2874,7 @@ public static final native int PtToolbar ();
//public static final native int PtColorPatch ();
//public static final native int PtColorPalette ();
-//public static final native int PtGroup ();
+public static final native int PtGroup ();
//public static final native int Pg_CM_RGB ();
//public static final native int Pg_CM_HSB ();
@@ -2890,4 +2912,16 @@ public static final native int PgShmemDestroy (int addr);
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);
+
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PgAlpha_t.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PgAlpha_t.java
index ebf21fad67..7485fdfd4c 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PgAlpha_t.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PgAlpha_t.java
@@ -1,8 +1,8 @@
package org.eclipse.swt.internal.photon;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class PgAlpha_t {
@@ -21,4 +21,4 @@ public class PgAlpha_t {
public byte dest_global_alpha;
// char spare[2]; *** unused
public static final int sizeof = 104;
-} \ No newline at end of file
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PgMap_t.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PgMap_t.java
index e41f9bfd48..d25f90f9bf 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PgMap_t.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PgMap_t.java
@@ -1,8 +1,8 @@
package org.eclipse.swt.internal.photon;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class PgMap_t {
@@ -13,4 +13,4 @@ public class PgMap_t {
public short bpp;
public int map;
public static final int sizeof = 12;
-} \ No newline at end of file
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PhArea_t.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PhArea_t.java
index ab892950c6..0a09362a26 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PhArea_t.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PhArea_t.java
@@ -1,8 +1,8 @@
package org.eclipse.swt.internal.photon;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class PhArea_t {
@@ -11,4 +11,4 @@ public class PhArea_t {
public short size_w;
public short size_h;
public static final int sizeof = 8;
-} \ No newline at end of file
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PhCursorDef_t.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PhCursorDef_t.java
new file mode 100755
index 0000000000..1bfe5c26cd
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PhCursorDef_t.java
@@ -0,0 +1,36 @@
+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/photon/org/eclipse/swt/internal/photon/PhCursorInfo_t.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PhCursorInfo_t.java
index 8249867c82..ad22c1e0ee 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PhCursorInfo_t.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PhCursorInfo_t.java
@@ -1,8 +1,8 @@
package org.eclipse.swt.internal.photon;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class PhCursorInfo_t {
@@ -35,4 +35,4 @@ public class PhCursorInfo_t {
public int zero2;
public static final int sizeof = 60;
-} \ No newline at end of file
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PhDim_t.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PhDim_t.java
index 95ccd121d6..66021b3848 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PhDim_t.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PhDim_t.java
@@ -1,12 +1,12 @@
package org.eclipse.swt.internal.photon;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (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;
-} \ No newline at end of file
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PhEvent_t.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PhEvent_t.java
index ee5a6ab230..4b0461f844 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PhEvent_t.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PhEvent_t.java
@@ -1,8 +1,8 @@
package org.eclipse.swt.internal.photon;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class PhEvent_t {
@@ -24,4 +24,4 @@ public class PhEvent_t {
public short num_rects;
public short data_len;
public static final int sizeof = 40;
-} \ No newline at end of file
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PhImage_t.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PhImage_t.java
index eaad75d4a4..539c1dee07 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PhImage_t.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PhImage_t.java
@@ -1,8 +1,8 @@
package org.eclipse.swt.internal.photon;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class PhImage_t {
@@ -25,4 +25,4 @@ public class PhImage_t {
public int palette;
public int image;
public static final int sizeof = 56;
-} \ No newline at end of file
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PhKeyEvent_t.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PhKeyEvent_t.java
index 3c74f4df11..1f0d2211b7 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PhKeyEvent_t.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PhKeyEvent_t.java
@@ -1,8 +1,8 @@
package org.eclipse.swt.internal.photon;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class PhKeyEvent_t {
@@ -18,4 +18,4 @@ public class PhKeyEvent_t {
public short pos_y;
public short button_state;
public static final int sizeof = 26;
-} \ No newline at end of file
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PhPoint_t.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PhPoint_t.java
index fabd9f25fe..5bcca4457f 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PhPoint_t.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PhPoint_t.java
@@ -1,12 +1,12 @@
package org.eclipse.swt.internal.photon;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (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;
-} \ No newline at end of file
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PhPointerEvent_t.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PhPointerEvent_t.java
index 9240762c20..07c8cd3491 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PhPointerEvent_t.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PhPointerEvent_t.java
@@ -1,8 +1,8 @@
package org.eclipse.swt.internal.photon;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class PhPointerEvent_t {
@@ -17,4 +17,4 @@ public class PhPointerEvent_t {
public int key_mods;
public int zero;
public static final int sizeof = 20;
-} \ No newline at end of file
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PhRect_t.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PhRect_t.java
index db6377c99a..0fe5db44e7 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PhRect_t.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PhRect_t.java
@@ -1,8 +1,8 @@
package org.eclipse.swt.internal.photon;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class PhRect_t {
@@ -11,4 +11,4 @@ public class PhRect_t {
public short lr_x;
public short lr_y;
public static final int sizeof = 8;
-} \ No newline at end of file
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PhRegion_t.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PhRegion_t.java
index b3d1b78c96..b7012858f1 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PhRegion_t.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PhRegion_t.java
@@ -1,8 +1,8 @@
package org.eclipse.swt.internal.photon;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class PhRegion_t {
@@ -29,4 +29,4 @@ public class PhRegion_t {
// public short zero3;
public static final int sizeof = 68;
-} \ No newline at end of file
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PhTile_t.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PhTile_t.java
index d006c2ade4..92f270ca42 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PhTile_t.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PhTile_t.java
@@ -1,8 +1,8 @@
package org.eclipse.swt.internal.photon;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class PhTile_t {
@@ -13,4 +13,4 @@ public class PhTile_t {
public short rect_lr_y;
public int next;
public static final int sizeof = 12;
-} \ No newline at end of file
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PhWindowEvent_t.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PhWindowEvent_t.java
index f490159630..4084fa5911 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PhWindowEvent_t.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PhWindowEvent_t.java
@@ -1,8 +1,8 @@
package org.eclipse.swt.internal.photon;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class PhWindowEvent_t {
@@ -19,4 +19,4 @@ public class PhWindowEvent_t {
public short input_group;
public int rsvd0, rsvd1, rsvd2, rsvd3;
public static final int sizeof = 40;
-} \ No newline at end of file
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PtCallbackInfo_t.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PtCallbackInfo_t.java
index 2ecde6b294..04b970a3fd 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PtCallbackInfo_t.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PtCallbackInfo_t.java
@@ -1,8 +1,8 @@
package org.eclipse.swt.internal.photon;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class PtCallbackInfo_t {
@@ -11,4 +11,4 @@ public class PtCallbackInfo_t {
public int event;
public int cbdata;
public static final int sizeof = 16;
-} \ No newline at end of file
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PtColorSelectInfo_t.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PtColorSelectInfo_t.java
index 54dec671d7..bab9c5b694 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PtColorSelectInfo_t.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PtColorSelectInfo_t.java
@@ -1,8 +1,8 @@
package org.eclipse.swt.internal.photon;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class PtColorSelectInfo_t {
@@ -24,4 +24,4 @@ public class PtColorSelectInfo_t {
public int rgb;
public int dialog;
public static final int sizeof = 52;
-} \ No newline at end of file
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PtContainerCallback_t.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PtContainerCallback_t.java
new file mode 100755
index 0000000000..a6d14e8f5e
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PtContainerCallback_t.java
@@ -0,0 +1,22 @@
+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/photon/org/eclipse/swt/internal/photon/PtFileSelectionInfo_t.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PtFileSelectionInfo_t.java
index 0cc12aef00..852218383d 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PtFileSelectionInfo_t.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PtFileSelectionInfo_t.java
@@ -1,8 +1,8 @@
package org.eclipse.swt.internal.photon;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class PtFileSelectionInfo_t {
@@ -22,4 +22,4 @@ public class PtFileSelectionInfo_t {
public int args;
public int [] spare = new int [4];
public static final int sizeof = 1500;
-} \ No newline at end of file
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PtScrollbarCallback_t.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PtScrollbarCallback_t.java
index aac48e6020..3185fabfb1 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PtScrollbarCallback_t.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PtScrollbarCallback_t.java
@@ -1,12 +1,12 @@
package org.eclipse.swt.internal.photon;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (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;
-} \ No newline at end of file
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PtTextCallback_t.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PtTextCallback_t.java
index abac0c47d9..77def5959a 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PtTextCallback_t.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PtTextCallback_t.java
@@ -1,8 +1,8 @@
package org.eclipse.swt.internal.photon;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class PtTextCallback_t {
@@ -15,4 +15,4 @@ public class PtTextCallback_t {
public int text;
public int doit;
public static final int sizeof = 30;
-} \ No newline at end of file
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PtTreeItem_t.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PtTreeItem_t.java
index 27f857a96c..d411b93bd9 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PtTreeItem_t.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PtTreeItem_t.java
@@ -1,8 +1,8 @@
package org.eclipse.swt.internal.photon;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class PtTreeItem_t {
@@ -22,4 +22,4 @@ public class PtTreeItem_t {
// char string [1];
// byte string;
public static final int sizeof = 40;
-} \ No newline at end of file
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/AbstractTreeItem.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/AbstractTreeItem.java
index b23dff6c03..41f7d95a58 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/AbstractTreeItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/AbstractTreeItem.java
@@ -1,14 +1,14 @@
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.*;
-/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
- */
-
/**
* This class stores and manages child items of a tree item.
* It provides protocol to query the index of an item relative
@@ -109,25 +109,20 @@ void deselectAll() {
treeItem.deselectAll();
}
}
-/**
- * Destroy all children of the receiver
- */
-void disposeItem() {
+public void dispose() {
+ if (!isValidWidget ()) return;
Vector children = getChildren();
AbstractTreeItem child;
while (children.size() > 0) { // TreeItem objects are removed from vector during dispose
child = (AbstractTreeItem) children.firstElement();
child.dispose();
}
- doDispose();
- super.disposeItem();
+ super.dispose();
}
-/**
- * Subclasses should free resources here
- */
void doDispose() {
setChildren(null);
visibleItemCount = 0;
+ super.doDispose();
}
/**
* Answer the Vector containing the child items of the receiver.
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
index 92992ee18a..43c4aeddc7 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.*;
@@ -41,6 +41,37 @@ public void addSelectionListener (SelectionListener listener) {
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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -58,18 +89,32 @@ public Point computeSize (int wHint, int hHint, boolean changed) {
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;
- if (hHint != SWT.DEFAULT) height = area.size_h;
+ 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;
@@ -197,6 +242,11 @@ void hookEvents () {
OS.PtAddCallback (handle, OS.Pt_CB_ACTIVATE, windowProc, SWT.Selection);
}
+int processActivate (int info) {
+ if (setFocus ()) click ();
+ return OS.Pt_CONTINUE;
+}
+
int processPaint (int damage) {
if ((style & SWT.ARROW) != 0) {
OS.PtSuperClassDraw (OS.PtButton (), handle, damage);
@@ -324,6 +374,7 @@ public void setText (String string) {
ptr2 = OS.malloc (buffer2.length);
OS.memmove (ptr2, buffer2, buffer2.length);
}
+ replaceMnemonic (mnemonic, 0);
int [] args = {
OS.Pt_ARG_TEXT_STRING, ptr, 0,
OS.Pt_ARG_LABEL_TYPE, OS.Pt_Z_STRING, 0,
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
index 1eff950532..24007b320d 100755
--- 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
@@ -1,12 +1,13 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.*;
import org.eclipse.swt.internal.photon.*;
+import org.eclipse.swt.graphics.*;
public class Canvas extends Composite {
Caret caret;
@@ -122,37 +123,9 @@ public void scroll (int destX, int destY, int x, int y, int width, int height, b
if (!isVisible ()) return;
boolean isVisible = (caret != null) && (caret.isVisible ());
if (isVisible) caret.hideCaret ();
- 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;
- OS.PtFlush ();
- OS.PhBlit(OS.PtWidgetRid(handle), rect, delta);
- boolean overlaps = (destX < x + width) && (destY < y + height) &&
- (destX + width > x) && (destY + height > y);
- if (!overlaps) {
- OS.PtDamageExtent (handle, 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 (handle, rect);
- }
- OS.free(damage_rects);
- }
+ GC gc = new GC (this);
+ gc.copyArea (x, y, width, height, destX, destY);
+ gc.dispose ();
if (isVisible) caret.showCaret ();
}
@@ -177,4 +150,4 @@ public void setCaret (Caret caret) {
}
}
-} \ No newline at end of file
+}
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
index 858ff99e8c..5d6a427547 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.photon.*;
@@ -219,4 +219,4 @@ boolean showCaret () {
isShowing = true;
return drawCaret ();
}
-} \ No newline at end of file
+}
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
index 15d71cf99d..dd2d8b6b81 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.*;
@@ -48,4 +48,4 @@ public void setRGB (RGB rgb) {
this.rgb = rgb;
}
-} \ No newline at end of file
+}
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
index 9b3723f87f..7fe9e578b3 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.*;
@@ -91,6 +91,7 @@ public Point computeSize (int wHint, int hHint, boolean changed) {
}
void createHandle (int index) {
+ state |= HANDLE;
Display display = getDisplay ();
int clazz = display.PtComboBox;
int parentHandle = parent.handle;
@@ -185,6 +186,23 @@ public void clearSelection () {
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);
+}
+
public String getItem (int index) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -309,6 +327,10 @@ public int getTextLimit () {
return args [1];
}
+boolean hasFocus () {
+ return OS.PtIsFocused (handle) != 0;
+}
+
void hookEvents () {
super.hookEvents ();
int windowProc = getDisplay ().windowProc;
@@ -319,7 +341,8 @@ void hookEvents () {
public int indexOf (String string) {
if (!isValidThread ()) error(SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error(SWT.ERROR_WIDGET_DISPOSED);
- return indexOf (string, 0);
+ byte [] buffer = Converter.wcsToMbcs (null, string, true);
+ return OS.PtListItemPos(handle, buffer) - 1;
}
public int indexOf (String string, int start) {
@@ -328,8 +351,7 @@ public int indexOf (String string, int start) {
if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
// NOT DONE - start is ignored
- byte [] buffer = Converter.wcsToMbcs (null, string, true);
- return OS.PtListItemPos(handle, buffer) - 1;
+ return indexOf (string);
}
int processModify (int info) {
@@ -353,6 +375,12 @@ int processSelection (int info) {
return OS.Pt_CONTINUE;
}
+void register () {
+ super.register ();
+ int child = OS.PtWidgetChildBack (handle);
+ WidgetTable.put (child, this);
+}
+
public void remove (int start, int end) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -494,4 +522,17 @@ public void setTextLimit (int limit) {
OS.PtSetResources (handle, args.length / 3, args);
}
-} \ No newline at end of file
+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;
+}
+
+}
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
index 40fc195c5a..b120e52b4e 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.photon.*;
@@ -72,6 +72,7 @@ public Point computeSize (int wHint, int hHint, boolean changed) {
}
void createHandle (int index) {
+ state |= HANDLE | CANVAS;
int parentHandle = parent.handle;
createScrolledHandle (parentHandle);
}
@@ -89,27 +90,36 @@ void createScrollBars () {
void createScrolledHandle (int parentHandle) {
int etches = OS.Pt_ALL_ETCHES | OS.Pt_ALL_OUTLINES;
int [] args = new int [] {
- /*
- * Bug in Photon. We must set Pt_GETS_FOCUS or Photon will
- * segment fault when no widget has focus and a key is pressed.
- */
- OS.Pt_ARG_FLAGS, OS.Pt_GETS_FOCUS, OS.Pt_GETS_FOCUS,
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_RESIZE_FLAGS, 0, OS.Pt_RESIZE_XY_BITS,
};
scrolledHandle = OS.PtCreateWidget (OS.PtContainer (), parentHandle, args.length / 3, args);
+ if ((style & SWT.NO_BACKGROUND) != 0) {
+ args = new int [] {OS.Pt_ARG_FILL_COLOR, OS.Pg_TRANSPARENT, 0};
+ OS.PtSetResources(scrolledHandle, args.length / 3, args);
+ }
if (scrolledHandle == 0) error (SWT.ERROR_NO_HANDLES);
Display display = getDisplay ();
int clazz = display.PtContainer;
args = new int [] {
- OS.Pt_ARG_FLAGS, OS.Pt_GETS_FOCUS, OS.Pt_GETS_FOCUS,
+ 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 () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ 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);
+}
public Control [] getChildren () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -137,6 +147,10 @@ boolean hasBorder () {
return (style & SWT.BORDER) != 0;
}
+boolean hasFocus () {
+ return OS.PtIsFocused (handle) == 2;
+}
+
void hookEvents () {
super.hookEvents ();
int windowProc = getDisplay ().windowProc;
@@ -169,8 +183,39 @@ public void layout (boolean changed) {
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) {
- OS.PtSuperClassDraw (OS.PtContainer (), handle, damage);
+ if ((state & CANVAS) != 0) {
+ if ((style & SWT.NO_BACKGROUND) == 0) {
+ OS.PtSuperClassDraw (OS.PtContainer (), handle, damage);
+ }
+ }
return super.processPaint (damage);
}
@@ -179,12 +224,17 @@ int processResize (int info) {
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 releaseWidget () {
+void releaseChildren () {
Control [] children = _getChildren ();
for (int i=0; i<children.length; i++) {
Control child = children [i];
@@ -193,6 +243,10 @@ void releaseWidget () {
child.releaseHandle ();
}
}
+}
+
+void releaseWidget () {
+ releaseChildren ();
super.releaseWidget ();
}
@@ -207,46 +261,66 @@ boolean sendResize () {
}
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) {
- int [] args = {OS.Pt_ARG_HEIGHT, 0, 0};
+ args = new int [] {OS.Pt_ARG_HEIGHT, 0, 0};
OS.PtGetResources (horizontalBar.handle, args.length / 3, args);
- height = height - (hBarHeight = args [1]);
+ clientHeight -= (hBarHeight = args [1]);
}
if (isVisibleVBar) {
- int [] args = {OS.Pt_ARG_WIDTH, 0, 0};
+ args = new int [] {OS.Pt_ARG_WIDTH, 0, 0};
OS.PtGetResources (verticalBar.handle, args.length / 3, args);
- width = width - (vBarWidth = args [1]);
- }
-
- //NOT DONE - used widget canvas to compute insets
- int left = 0, right = 0;
- if (hasBorder ()) {
- left = 2;
- if (isVisibleHBar && isVisibleVBar) right = 3;
+ clientWidth -= (vBarWidth = args [1]);
}
if (isVisibleHBar) {
- horizontalBar.setBounds (-left, height - left, width + right, hBarHeight);
+ horizontalBar.setBounds (0, clientHeight, clientWidth, hBarHeight);
}
if (isVisibleVBar) {
- verticalBar.setBounds (width - left, -left, vBarWidth, height + right);
+ verticalBar.setBounds (clientWidth, 0, vBarWidth, clientHeight);
}
-
- PhArea_t area = new PhArea_t ();
- area.size_w = (short) (Math.max (width - (left * 2), 0));
- area.size_h = (short) (Math.max (height - (left * 2), 0));
- int ptr = OS.malloc (PhArea_t.sizeof);
- OS.memmove (ptr, area, PhArea_t.sizeof);
- int [] args = {OS.Pt_ARG_AREA, ptr, 0};
+ 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);
- OS.free (ptr);
}
void setBounds (int x, int y, int width, int height, boolean move, boolean resize) {
- if (resize) resizeClientArea (width, height);
super.setBounds (x, y, width, height, move, resize);
+ if (resize) resizeClientArea (width, height);
}
public void setLayout (Layout layout) {
@@ -255,4 +329,9 @@ public void setLayout (Layout layout) {
this.layout = layout;
}
-} \ No newline at end of file
+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
index 079c6efd82..e9dd1b72c3 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.photon.*;
@@ -14,6 +14,8 @@ public abstract class Control extends Widget implements Drawable {
Composite parent;
Menu menu;
Object layoutData;
+ String toolTipText;
+ int toolTipHandle;
Control () {
/* Do nothing */
@@ -109,7 +111,8 @@ public boolean forceFocus () {
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
int shellHandle = OS.PtFindDisjoint (handle);
OS.PtWindowToFront (shellHandle);
- return handle != OS.PtContainerGiveFocus (handle, null);
+ OS.PtContainerGiveFocus (handle, null);
+ return hasFocus ();
}
public Point computeSize (int wHint, int hHint) {
@@ -147,6 +150,7 @@ public Color getBackground () {
OS.PtGetResources (handle, args.length / 3, args);
return Color.photon_new (getDisplay (), args [1]);
}
+
public Font getFont () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -169,6 +173,7 @@ public Font getFont () {
}
return Font.photon_new (getDisplay (), font);
}
+
public Color getForeground () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -183,15 +188,17 @@ public int getBorderWidth () {
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 [4];
+// if ((flags & OS.Pt_ALL_BEVELS) != 0) border += args [7];
return border;
}
@@ -245,6 +252,23 @@ public Composite getParent () {
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;
+}
+
public Point getSize () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -257,7 +281,7 @@ public Point getSize () {
public String getToolTipText () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return null;
+ return toolTipText;
}
public Shell getShell () {
@@ -276,18 +300,24 @@ public boolean getVisible () {
}
boolean hasFocus () {
- return OS.PtIsFocused (handle) == 2;
+ return OS.PtIsFocused (handle) != 0;
}
void hookEvents () {
int windowProc = getDisplay ().windowProc;
- OS.PtAddEventHandler (handle, OS.Ph_EV_KEY, windowProc, SWT.KeyDown);
+ 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 (handle, OS.Pt_CB_GOT_FOCUS, windowProc, SWT.FocusIn);
- OS.PtAddCallback (handle, OS.Pt_CB_LOST_FOCUS, windowProc, SWT.FocusOut);
+ 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;
}
public int internal_new_GC (GCData data) {
@@ -384,6 +414,30 @@ int processPaint (int damage) {
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.
@@ -393,6 +447,20 @@ int processFocusIn (int info) {
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.
@@ -401,27 +469,21 @@ int processFocusOut (int info) {
}
int processKey (int info) {
- if (info == 0) return OS.Pt_END;
+ 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_END;
+ 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_END;
+ if (data == 0) return OS.Pt_PROCESS;
PhKeyEvent_t ke = new PhKeyEvent_t ();
OS.memmove (ke, data, PhKeyEvent_t.sizeof);
- /*
- * Feature in Photon. The multi-line text widget consumes
- * key down events. The fix is to use a filter callback
- * for the text widget to see the key down. The following
- * code ignores key up when called from a filter callback.
- */
- if (cbinfo.reason == OS.Pt_CB_FILTER) {
- if ((ke.key_flags & (OS.Pk_KF_Key_Down | OS.Pk_KF_Key_Repeat)) == 0) {
- return OS.Pt_PROCESS;
- }
- }
+
/*
* Feature in Photon. When the user presses certain keys
* (such as the arrow keys), Photon sends 2 event for one
@@ -431,7 +493,7 @@ int processKey (int info) {
* first event.
*/
if (ke.key_flags == OS.Pk_KF_Scan_Valid) {
- return (cbinfo.reason == OS.Pt_CB_FILTER) ? OS.Pt_PROCESS : OS.Pt_END;
+ return OS.Pt_PROCESS;
}
if ((ke.key_flags & OS.Pk_KF_Key_Repeat) != 0) {
if ((ke.key_flags & OS.Pk_KF_Sym_Valid) != 0) {
@@ -442,16 +504,45 @@ int processKey (int info) {
case OS.Pk_Control_R:
case OS.Pk_Shift_L:
case OS.Pk_Shift_R:
- /*
- * Bug in Photon. Despite the fact that we return Pt_END,
- * for some reason, Photon continues to forward the event
- * to the parent. The fix is to change the event type to
- * zero. This doesn't stop the forwarding but makes the
- * event unknown.
- */
- if (cbinfo.reason == OS.Pt_CB_FILTER) return OS.Pt_PROCESS;
- OS.memmove (cbinfo.event, new int [1], 4);
- return OS.Pt_END;
+ return OS.Pt_PROCESS;
+ }
+ }
+ }
+
+ 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;
+ }
}
}
}
@@ -469,12 +560,12 @@ int processKey (int info) {
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_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;
+ case OS.Pk_Escape: event.character = 0x1B; break;
+ case OS.Pk_Delete: event.character = 0x7F; break;
default:
event.character = (char) ke.key_sym;
}
@@ -482,42 +573,14 @@ int processKey (int info) {
display.lastKey = event.keyCode;
display.lastAscii = event.character;
}
- if ((ke.key_mods & OS.Pk_KM_Alt) != 0) {
- if (type != SWT.KeyDown || event.keyCode != SWT.ALT) {
- event.stateMask |= SWT.ALT;
- }
- }
- if ((ke.key_mods & OS.Pk_KM_Shift) != 0) {
- if (type != SWT.KeyDown || event.keyCode != SWT.SHIFT) {
- event.stateMask |= SWT.SHIFT;
- }
- }
- if ((ke.key_mods & OS.Pk_KM_Ctrl) != 0) {
- if (type != SWT.KeyDown || event.keyCode != SWT.CONTROL) {
- event.stateMask |= SWT.CONTROL;
- }
- }
- if ((ke.button_state & OS.Ph_BUTTON_SELECT) != 0) event.stateMask |= SWT.BUTTON1;
- if ((ke.button_state & OS.Ph_BUTTON_ADJUST) != 0) event.stateMask |= SWT.BUTTON2;
- if ((ke.button_state & OS.Ph_BUTTON_MENU) != 0) event.stateMask |= SWT.BUTTON3;
+ setKeyState(event, ke);
if (type == SWT.KeyUp) {
if (event.keyCode == 0) event.keyCode = display.lastKey;
if (event.character == 0) event.character = (char) display.lastAscii;
- 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;
}
postEvent (type, event);
- /*
- * Bug in Photon. Despite the fact that we return Pt_END,
- * for some reason, Photon continues to forward the event
- * to the parent. The fix is to change the event type to
- * zero. This doesn't stop the forwarding but makes the
- * event unknown.
- */
- if (cbinfo.reason == OS.Pt_CB_FILTER) return OS.Pt_PROCESS;
- OS.memmove (cbinfo.event, new int [1], 4);
- return OS.Pt_END;
+
+ return OS.Pt_PROCESS;
}
int processMouse (int info) {
@@ -527,6 +590,9 @@ int processMouse (int info) {
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:
@@ -556,43 +622,25 @@ int processMouse (int info) {
OS.memmove (pe, data, PhPointerEvent_t.sizeof);
event.x = pe.pos_x + ev.translation_x;
event.y = pe.pos_y + ev.translation_y;
- int type = ev.type;
- int buttons = pe.buttons;
- int key_mods = pe.key_mods;
- int button_state = pe.button_state;
- int click_count = pe.click_count;
- switch (buttons) {
+ 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;
}
- 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;
- if (type == OS.Ph_EV_BUT_PRESS) {
- if (buttons == OS.Ph_BUTTON_SELECT && (button_state & OS.Ph_BUTTON_SELECT) != 0) {
- event.stateMask &= ~SWT.BUTTON1;
- }
- if (buttons == OS.Ph_BUTTON_ADJUST && (button_state & OS.Ph_BUTTON_ADJUST) != 0) {
- event.stateMask &= ~SWT.BUTTON2;
- }
- if (buttons == OS.Ph_BUTTON_MENU && (button_state & OS.Ph_BUTTON_MENU) != 0) {
- event.stateMask &= ~SWT.BUTTON3;
- }
- }
- if (type == OS.Ph_EV_BUT_RELEASE) {
- 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;
- }
+ setMouseState (event, pe);
postEvent (event.type, event);
- if (type == OS.Ph_EV_BUT_PRESS && click_count == 2) {
- postEvent (SWT.MouseDoubleClick, 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);
}
- return OS.Pt_END;
+ ev.processing_flags |= OS.Ph_CONSUMED;
+ OS.memmove (cbinfo.event, ev, PhEvent_t.sizeof);
+ return OS.Pt_CONTINUE;
}
int processMouseEnter (int info) {
@@ -617,11 +665,32 @@ int processMouseEnter (int info) {
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)) {
@@ -629,6 +698,16 @@ void realizeWidget() {
}
}
+void releaseWidget () {
+ super.releaseWidget ();
+ if (menu != null && !menu.isDisposed ()) {
+ menu.dispose ();
+ }
+ menu = null;
+ parent = null;
+ layoutData = null;
+}
+
public void redraw () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -789,9 +868,28 @@ public void setCursor (Cursor cursor) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
int type = OS.Ph_CURSOR_INHERIT;
- if (cursor != null) type = cursor.handle;
- int [] args = {OS.Pt_ARG_CURSOR_TYPE, type, 0};
+ int bitmap = 0;
+ if (cursor != null) {
+ 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);
+ }
}
public void setEnabled (boolean enabled) {
@@ -831,18 +929,20 @@ void sendPaintEvent (int damage) {
/* Send the paint event */
PhTile_t tile = new PhTile_t ();
OS.memmove (tile, damage, PhTile_t.sizeof);
- 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 ();
+ 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);
- event.gc = null;
}
boolean sendResize () {
@@ -882,16 +982,32 @@ public void setForeground (Color color) {
OS.PtSetResources (handle, args.length / 3, args);
}
-public void setMenu (Menu menu) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- this.menu = menu;
-}
-
-public boolean setParent (Composite parent) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- return false;
+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) {
+ if (event.type != SWT.KeyDown || event.keyCode != SWT.ALT) {
+ event.stateMask |= SWT.ALT;
+ }
+ }
+ if ((key_mods & OS.Pk_KM_Shift) != 0) {
+ if (event.type != SWT.KeyDown || event.keyCode != SWT.SHIFT) {
+ event.stateMask |= SWT.SHIFT;
+ }
+ }
+ if ((key_mods & OS.Pk_KM_Ctrl) != 0) {
+ if (event.type != SWT.KeyDown || event.keyCode != SWT.CONTROL) {
+ 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;
+ if (event.type == 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;
+ }
}
public void setLayoutData (Object layoutData) {
@@ -913,6 +1029,51 @@ public void setLocation (Point location) {
setLocation (location.x, location.y);
}
+public void setMenu (Menu menu) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ int flags = menu != null ? OS.Pt_MENUABLE : 0;
+ int [] args = {
+ OS.Pt_ARG_FLAGS, flags, OS.Pt_ALL_BUTTONS | OS.Pt_MENUABLE,
+ };
+ OS.PtSetResources (handle, args.length / 3, args);
+ this.menu = menu;
+}
+
+void setMouseState(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;
+ if (event.type == SWT.MouseDown) {
+ if (buttons == OS.Ph_BUTTON_SELECT && (button_state & OS.Ph_BUTTON_SELECT) != 0) {
+ event.stateMask &= ~SWT.BUTTON1;
+ }
+ if (buttons == OS.Ph_BUTTON_ADJUST && (button_state & OS.Ph_BUTTON_ADJUST) != 0) {
+ event.stateMask &= ~SWT.BUTTON2;
+ }
+ if (buttons == OS.Ph_BUTTON_MENU && (button_state & OS.Ph_BUTTON_MENU) != 0) {
+ event.stateMask &= ~SWT.BUTTON3;
+ }
+ }
+ if (event.type == SWT.MouseUp) {
+ 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;
+ }
+}
+
+public boolean setParent (Composite parent) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return false;
+}
+
public void setSize (Point size) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -954,18 +1115,35 @@ public void setVisible (boolean visible) {
public void setToolTipText (String string) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ 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;
+ }
+ }
+ }
+ }
+}
+
public Point toControl (Point point) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
short [] x = new short [1], y = new short [1];
OS.PtGetAbsPosition (handle, x, y);
- return new Point (x [0] - point.x, y [0] - point.y);
+ return new Point (point.x - x [0], point.y - y [0]);
}
public Point toDisplay (Point point) {
@@ -976,12 +1154,119 @@ public Point toDisplay (Point point) {
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;
+}
+
public boolean traverse (int traversal) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ 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;
+}
+
public void update () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
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
index 80f4787cc6..014dca0453 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.photon.*;
@@ -112,6 +112,7 @@ void releaseWidget () {
menuBar = null;
menus = null;
image = null;
+ text = null;
super.releaseWidget ();
}
@@ -126,13 +127,28 @@ void remove (Menu menu) {
}
void resizeBounds (int width, int height) {
+ int menuHeight = 0;
if (menuBar != null) {
- int [] args = {OS.Pt_ARG_HEIGHT, 0, 0};
- OS.PtGetResources (menuBar.handle, args.length / 3, args);
- height = Math.max (height - args [1], 0);
+ 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;
}
- int [] args = {OS.Pt_ARG_WIDTH, width, 0, OS.Pt_ARG_HEIGHT, height, 0};
+ 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);
}
@@ -171,4 +187,4 @@ public void setText (String string) {
text = string;
}
-} \ No newline at end of file
+}
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
index dc7aad26e1..62c1e91099 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.*;
@@ -58,4 +58,4 @@ public void setMessage (String string) {
message = string;
}
-} \ No newline at end of file
+}
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
index f4412502fa..4bd481006c 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.*;
@@ -27,8 +27,8 @@ public /*final*/ class Display extends Device {
Event [] eventQueue;
/* Events Dispatching and Callback */
- Callback windowCallback, drawCallback, workCallback, inputCallback;
- int windowProc, drawProc, workProc, inputProc, input, pulse;
+ Callback windowCallback, drawCallback, workCallback, inputCallback, hotkeyCallback;
+ int windowProc, drawProc, workProc, inputProc, hotkeyProc, input, pulse;
boolean idle;
/* Sync/Async Widget Communication */
@@ -140,9 +140,16 @@ public /*final*/ class Display extends Device {
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;
@@ -159,6 +166,22 @@ public /*final*/ class Display extends Device {
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 () {
+ CurrentDevice = getCurrent ();
+ if (CurrentDevice == null) {
+ CurrentDevice = getDefault ();
+ }
+ }
+ };
+ }
public Display () {
this (null);
@@ -195,6 +218,32 @@ 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 ();
@@ -407,23 +456,25 @@ public Color getSystemColor (int id) {
checkDevice ();
int color = 0x000000;
switch (id) {
- case SWT.COLOR_TITLE_FOREGROUND: color = 0x000000; break;
- case SWT.COLOR_TITLE_BACKGROUND: color = 0x6493E7; break;
+ 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: 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;
+ 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);
}
@@ -445,12 +496,19 @@ public Thread getThread () {
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 () {
@@ -469,6 +527,9 @@ void initializeDisplay () {
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);
@@ -483,6 +544,36 @@ void initializeDisplay () {
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 = {
@@ -529,36 +620,57 @@ void initializeWidgetClasses () {
void initializeWidgetColors () {
OS.PtSetParentWidget (0);
- int shellHandle = OS.PtCreateWidget (OS.PtWindow (), 0, 0, null);
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.Pt_ARG_OUTLINE_COLOR, 0, 0,
- OS.Pt_ARG_OUTLINE_COLOR, 0, 0,
- OS.Pt_ARG_OUTLINE_COLOR, 0, 0,
- OS.Pt_ARG_INLINE_COLOR, 0, 0,
- OS.Pt_ARG_INLINE_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];
- WIDGET_BORDER = args [13];
- WIDGET_DARK_SHADOW = args [16];
- WIDGET_NORMAL_SHADOW = args [19];
- WIDGET_LIGHT_SHADOW = args [22];
- WIDGET_HIGHLIGHT_SHADOW = args [25];
+
+ /*
+ * 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);
}
@@ -713,14 +825,10 @@ void releaseDisplay () {
OS.PtAppRemoveInput (app_context, input);
OS.PtAppDeletePulse (app_context, pulse);
- /* Free the window proc */
- windowCallback.dispose ();
- windowCallback = null;
-
/* Free the timers */
if (timers != null) {
- for (int i=0; i<=timers.length; i++) {
- OS.PtDestroyWidget (timers [i]);
+ for (int i=0; i<timers.length; i++) {
+ if (timers [i] != 0) OS.PtDestroyWidget (timers [i]);
}
}
timers = null;
@@ -728,7 +836,11 @@ void releaseDisplay () {
timerProc = 0;
timerCallback.dispose ();
timerCallback = null;
-
+
+ /* Free the window proc */
+ windowCallback.dispose ();
+ windowCallback = null;
+
/* Free callbacks */
drawCallback.dispose();
drawCallback = null;
@@ -736,6 +848,8 @@ void releaseDisplay () {
workCallback = null;
inputCallback.dispose();
inputCallback = null;
+ hotkeyCallback.dispose();
+ hotkeyCallback = null;
/* Release references */
thread = null;
@@ -858,6 +972,15 @@ public void syncExec (Runnable runnable) {
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;
+}
+
public void timerExec (int milliseconds, Runnable runnable) {
checkDevice ();
if (timerList == null) timerList = new Runnable [4];
@@ -932,7 +1055,7 @@ public void wake () {
int windowProc (int handle, int data, int info) {
Widget widget = WidgetTable.get (handle);
if (widget == null) return OS.Pt_CONTINUE;
- return widget.processEvent (data, info);
+ return widget.processEvent (handle, data, info);
}
int workProc (int data) {
@@ -940,4 +1063,59 @@ int workProc (int data) {
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 && Character.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 && !Character.isWhitespace (text.charAt (i))) {
+ i++;
+ }
+ wordEnd = i - 1;
+ String line = text.substring (lineStart, wordEnd + 1);
+ int lineWidth = textWidth (line, font);
+ while (i < lineEnd && Character.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
index d456c137b4..d030f4382b 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.*;
@@ -122,4 +122,4 @@ public void setFilterPath (String string) {
filterPath = string;
}
-} \ No newline at end of file
+}
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
index 6402e9c2e4..3737d6d850 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.*;
@@ -56,4 +56,4 @@ public FontData open () {
public void setFontData (FontData fontData) {
this.fontData = fontData;
}
-} \ No newline at end of file
+}
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
index 7f5022c5cf..cd6c3535ff 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.*;
@@ -53,6 +53,7 @@ protected void checkSubclass () {
}
void createHandle (int index) {
+ state |= HANDLE;
Display display = getDisplay ();
int clazz = display.PtPane;
int parentHandle = parent.handle;
@@ -119,4 +120,4 @@ public void setText (String string) {
OS.free (ptr);
}
-} \ No newline at end of file
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Header.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Header.java
index 0c2e37f0b6..c77ad8aa33 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Header.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Header.java
@@ -1,14 +1,14 @@
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.util.*;
-
-/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
- */
/**
* A header draws one or more header items. Each item may have a text
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
index ac5f1acd86..0bd2a8b36b 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.*;
@@ -11,6 +11,7 @@ import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
public class Label extends Control {
+ String text = "";
Image image;
public Label (Composite parent, int style) {
@@ -24,9 +25,9 @@ static int checkStyle (int style) {
public Point computeSize (int wHint, int hHint, boolean changed) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- int border = getBorderWidth ();
- int width = border * 2, height = border * 2;
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 {
@@ -36,23 +37,79 @@ public Point computeSize (int wHint, int hHint, boolean changed) {
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);
- width = dim.w; height = dim.h;
+ 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;
- if (hHint != SWT.DEFAULT) height = area.size_h;
+ 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;
@@ -75,8 +132,12 @@ void createHandle (int index) {
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_RESIZE_FLAGS, 0, OS.Pt_RESIZE_XY_BITS,
};
handle = OS.PtCreateWidget (clazz, parentHandle, args.length / 3, args);
@@ -107,44 +168,7 @@ public String getText () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
if ((style & SWT.SEPARATOR) != 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);
+ return text;
}
int processPaint (int damage) {
@@ -154,9 +178,28 @@ int processPaint (int 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;
}
public void setAlignment (int alignment) {
@@ -172,10 +215,20 @@ public void setAlignment (int alignment) {
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 () {
return false;
}
+public void setFont (Font font) {
+ super.setFont (font);
+ if ((style & SWT.WRAP) != 0) setText (text);
+}
+
public void setImage (Image image) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -196,20 +249,45 @@ public void setText (String string) {
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
if ((style & SWT.SEPARATOR) != 0) return;
- char [] text = new char [string.length ()];
- string.getChars (0, text.length, text, 0);
+ 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 < 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];
+ 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 < text.length) text [j++] = 0;
- byte [] buffer = Converter.wcsToMbcs (null, text, true);
+ 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;
@@ -218,6 +296,7 @@ public void setText (String string) {
ptr2 = OS.malloc (buffer2.length);
OS.memmove (ptr2, buffer2, buffer2.length);
}
+ replaceMnemonic (mnemonic, 0);
int [] args = {
OS.Pt_ARG_TEXT_STRING, ptr, 0,
OS.Pt_ARG_LABEL_TYPE, OS.Pt_Z_STRING, 0,
@@ -228,4 +307,4 @@ public void setText (String string) {
OS.free (ptr2);
}
-} \ No newline at end of file
+}
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
index 5fc15bfb72..042df8e3d3 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.*;
@@ -112,6 +112,7 @@ public Point computeSize (int wHint, int hHint, boolean changed) {
}
void createHandle (int index) {
+ state |= HANDLE;
Display display = getDisplay ();
int clazz = display.PtList;
int parentHandle = parent.handle;
@@ -125,7 +126,9 @@ void createHandle (int index) {
}
}
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,
@@ -152,14 +155,14 @@ public void deselect (int start, int end) {
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
if (start > end) return;
if ((style & SWT.SINGLE) != 0) {
- int [] args = new int [] {OS.Pt_ARG_LIST_SEL_COUNT, 0, 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++) {
+ for (int i=start; i<=end; i++) {
OS.PtListUnselectPos (handle, i + 1);
}
}
@@ -317,7 +320,7 @@ public int getTopIndex () {
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
int [] args = new int [] {OS.Pt_ARG_TOP_ITEM_POS, 0, 0};
OS.PtGetResources (handle, args.length / 3, args);
- return args [1];
+ return args [1] - 1;
}
void hookEvents () {
@@ -330,7 +333,8 @@ void hookEvents () {
public int indexOf (String string) {
if (!isValidThread ()) error(SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error(SWT.ERROR_WIDGET_DISPOSED);
- return indexOf (string, 0);
+ byte [] buffer = Converter.wcsToMbcs (null, string, true);
+ return OS.PtListItemPos(handle, buffer) - 1;
}
public int indexOf (String string, int start) {
@@ -339,8 +343,7 @@ public int indexOf (String string, int start) {
if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
// NOT DONE - start is ignored
- byte [] buffer = Converter.wcsToMbcs (null, string, true);
- return OS.PtListItemPos(handle, buffer) - 1;
+ return indexOf (string);
}
public boolean isSelected (int index) {
@@ -402,11 +405,20 @@ public void remove (int [] indices) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
if (indices == null) error (SWT.ERROR_NULL_ARGUMENT);
-
- //NOT DONE
+ 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);
+ }
}
-
public void remove (int start, int end) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -426,7 +438,6 @@ public void removeAll () {
OS.PtListDeleteAllItems (handle);
}
-
public void removeSelectionListener(SelectionListener listener) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -440,18 +451,22 @@ public void select (int start, int end) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
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 [] args = new int [] {OS.Pt_ARG_LIST_SEL_COUNT, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- int count = args [1];
int index = Math.min (count - 1, end);
if (index >= start) select (index);
return;
}
- for (int i=start; i<end; i++) {
- OS.PtListSelectPos (handle, start + 1);
+ int gotoIndex = -1;
+ for (int index=end; index>=start; index--) {
+ if (0 <= index && index < count) {
+ gotoIndex = index;
+ OS.PtListSelectPos (handle, index + 1);
+ }
}
- OS.PtListGotoPos (handle, start + 1);
+ if (gotoIndex != -1) OS.PtListGotoPos (handle, gotoIndex + 1);
}
public void select (int [] indices) {
@@ -459,27 +474,37 @@ public void select (int [] indices) {
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
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++) {
- if (indices [i] >= 0) {
- OS.PtListSelectPos (handle, indices [i] + 1);
+ int index = indices [i];
+ if (0 <= index && index < count) {
+ gotoIndex = index;
+ OS.PtListSelectPos (handle, index + 1);
}
}
- OS.PtListGotoPos (handle, indices [0] + 1);
+ if (gotoIndex != -1) OS.PtListGotoPos (handle, gotoIndex + 1);
}
public void select (int index) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
if (index < 0) return;
- OS.PtListSelectPos (handle, index + 1);
- OS.PtListGotoPos (handle, index + 1);
+ 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);
+ }
}
public void selectAll () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
if ((style & SWT.SINGLE) != 0) return;
- int [] args = new int [] {OS.Pt_ARG_LIST_SEL_COUNT, 0, 0};
+ 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++) {
@@ -586,4 +611,12 @@ public void showSelection () {
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
index 929031a615..535e47327f 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.photon.*;
@@ -14,7 +14,7 @@ public class Menu extends Widget {
int x, y;
boolean hasLocation;
Decorations parent;
- MenuItem cascade;
+ MenuItem cascade, defaultItem;
public Menu (Control parent) {
this (checkNull (parent).getShell (), SWT.POP_UP);
@@ -71,6 +71,7 @@ public void addMenuListener (MenuListener listener) {
}
void createHandle (int index) {
+ state |= HANDLE;
int parentHandle = parent.topHandle ();
if ((style & SWT.BAR) != 0) {
int [] args = {
@@ -92,8 +93,7 @@ void createWidget (int index) {
public MenuItem getDefaultItem () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- //NOT DONE - NOT NEEDED
- return null;
+ return defaultItem;
}
public Display getDisplay () {
@@ -126,12 +126,19 @@ public int getItemCount () {
public MenuItem getItem (int index) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- //NOT DONE - bogus
- MenuItem[] items = getItems();
- if (!(0 <= index && index < items.length)) {
- error (SWT.ERROR_INVALID_RANGE);
+ 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);
}
- return items [index];
+ error (SWT.ERROR_INVALID_RANGE);
+ return null;
}
public MenuItem [] getItems () {
@@ -206,7 +213,6 @@ public boolean getVisible () {
void hookEvents () {
int windowProc = getDisplay ().windowProc;
- OS.PtAddCallback (handle, OS.Pt_CB_REALIZED, windowProc, SWT.Show);
OS.PtAddCallback (handle, OS.Pt_CB_UNREALIZED, windowProc, SWT.Hide);
}
@@ -214,10 +220,14 @@ 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);
- //NOT DONE - bogus
- MenuItem[] items = getItems();
- for (int i=0; i<items.length; i++) {
- if (item == items [i]) return i;
+ 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;
}
@@ -237,15 +247,16 @@ public boolean isVisible () {
}
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;
}
-int processShow (int info) {
- sendEvent (SWT.Show);
- return OS.Pt_CONTINUE;
-}
-
void releaseChild () {
super.releaseChild ();
if (cascade != null) cascade.setMenu (null);
@@ -266,7 +277,7 @@ void releaseWidget () {
super.releaseWidget ();
if (parent != null) parent.remove (this);
parent = null;
-
+ cascade = null;
}
public void removeHelpListener (HelpListener listener) {
@@ -289,7 +300,7 @@ public void removeMenuListener (MenuListener listener) {
public void setDefaultItem (MenuItem item) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- //NOT DONE - NOT NEEDED
+ defaultItem = item;
}
public void setEnabled (boolean enabled) {
@@ -329,10 +340,11 @@ public void setVisible (boolean visible) {
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);
}
}
-} \ No newline at end of file
+}
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
index e014e1f8b0..69268fe0a7 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.*;
@@ -13,6 +13,8 @@ import org.eclipse.swt.events.*;
public class MenuItem extends Item {
Menu parent, menu;
+ int accelerator;
+ boolean enabled = true;
public MenuItem (Menu parent, int style) {
this (parent, style, parent.getItemCount());
@@ -58,6 +60,7 @@ static int checkStyle (int style) {
}
void createHandle (int index) {
+ state |= HANDLE;
int count = parent.getItemCount();
if (!(0 <= index && index <= count)) error (SWT.ERROR_INVALID_RANGE);
int parentHandle = parent.handle;
@@ -65,8 +68,6 @@ void createHandle (int index) {
handle = OS.PtCreateWidget (OS.PtSeparator (), parentHandle, 0, null);
} else if ((style & (SWT.CHECK | SWT.RADIO)) != 0) {
int [] args = {
-// OS.Pt_ARG_FLAGS, OS.Pt_MENU_BUTTON | OS.Pt_SELECTABLE, OS.Pt_MENU_BUTTON | OS.Pt_SELECTABLE,
-// OS.Pt_ARG_FLAGS, OS.Pt_AUTOHIGHLIGHT, OS.Pt_AUTOHIGHLIGHT,
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);
@@ -91,18 +92,13 @@ void createHandle (int index) {
}
if (OS.PtWidgetIsRealized (parentHandle)) {
OS.PtRealizeWidget (topHandle ());
- if ((parent.style & SWT.BAR) == 0) {
- OS.PtExtentWidgetFamily (parentHandle);
- OS.PtPositionMenu (parentHandle, null);
- }
}
}
public int getAccelerator () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- //NOT DONE - NOT NEEDED
- return 0;
+ return accelerator;
}
public Display getDisplay () {
@@ -114,9 +110,16 @@ public Display getDisplay () {
public boolean getEnabled () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- int [] args = {OS.Pt_ARG_FLAGS, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
- return (args [1] & OS.Pt_BLOCKED) == 0;
+ /*
+ * 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;
}
public Menu getMenu () {
@@ -149,15 +152,22 @@ 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.Show);
+ 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);
+ }
}
public boolean isEnabled () {
return getEnabled () && parent.isEnabled ();
}
+int processActivate (int info) {
+ return processArm (info);
+}
+
int processSelection (int info) {
if ((style & SWT.CASCADE) != 0) {
int [] args = {OS.Pt_ARG_BUTTON_TYPE, 0, 0};
@@ -170,38 +180,79 @@ int processSelection (int info) {
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) {
+ if (menu != null) {
+ 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);
+ }
+ }
+ return OS.Pt_CONTINUE;
+}
+
void releaseChild () {
super.releaseChild ();
if (menu != null) menu.dispose ();
menu = null;
-// parent.destroyItem (this);
}
void releaseWidget () {
- if (menu != null) {
+ if (menu != null && !menu.isDisposed ()) {
menu.releaseWidget ();
menu.releaseHandle ();
}
menu = null;
super.releaseWidget ();
-// if (accelerator != 0) {
-// parent.destroyAcceleratorTable ();
-// }
-// accelerator = 0;
-// Decorations shell = parent.parent;
-// shell.remove (this);
+ if (accelerator != 0) removeAccelerator ();
+ accelerator = 0;
parent = null;
}
-int processShow (int damage) {
- if (menu != null) {
- int menuHandle = menu.handle;
- OS.PtPositionMenu (menuHandle, null);
- OS.PtRealizeWidget (menuHandle);
- }
- return OS.Pt_CONTINUE;
-}
-
public void removeArmListener (ArmListener listener) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -218,6 +269,22 @@ public void removeHelpListener (HelpListener listener) {
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);
+}
+
public void removeSelectionListener (SelectionListener listener) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -231,24 +298,28 @@ public void setAccelerator (int accelerator) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- //NOT DONE: remove previous - NEEDED NEEDED
-//
-// if (accelerator != 0) {
-// 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);
-// //key = Display.untranslateKey(key);
-// key = 0x61;
-// System.out.println("key=" + Integer.toHexString(key));
-// OS.PtAddHotkeyHandler(handle, key, keyMods, (short)0, SWT.Selection, 0);
-// }
+ 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);
}
public void setEnabled (boolean enabled) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ 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,
@@ -284,26 +355,17 @@ public void setMenu (Menu menu) {
this.menu = menu;
if (oldMenu != null) {
oldMenu.cascade = null;
- int menuHandle = oldMenu.handle;
- int shellHandle = oldMenu.parent.topHandle ();
if ((parent.style & SWT.BAR) == 0) {
- int [] args = {OS.Pt_ARG_BUTTON_TYPE, 0, OS.Pt_MENU_RIGHT};
+ int [] args = {OS.Pt_ARG_BUTTON_TYPE, OS.Pt_MENU_TEXT, 0};
OS.PtSetResources (handle, args.length / 3, args);
- args = new int [] {OS.Pt_ARG_MENU_FLAGS, 0, OS.Pt_MENU_CHILD};
- OS.PtSetResources (menuHandle, args.length / 3, args);
}
- OS.PtReParentWidget (menuHandle, shellHandle);
}
if (menu != null) {
menu.cascade = this;
- int menuHandle = menu.handle;
if ((parent.style & SWT.BAR) == 0) {
- int [] args = {OS.Pt_ARG_BUTTON_TYPE, OS.Pt_MENU_RIGHT, OS.Pt_MENU_RIGHT};
+ int [] args = {OS.Pt_ARG_BUTTON_TYPE, OS.Pt_MENU_RIGHT, 0};
OS.PtSetResources (handle, args.length / 3, args);
- args = new int [] {OS.Pt_ARG_MENU_FLAGS, OS.Pt_MENU_CHILD, OS.Pt_MENU_CHILD};
- OS.PtSetResources (menuHandle, args.length / 3, args);
}
- OS.PtReParentWidget (menuHandle, handle);
}
}
@@ -333,31 +395,51 @@ public void setText (String string) {
if (mnemonic == 0) mnemonic = text [i];
j--;
}
- }
- byte [] buffer2;
+ }
+ int keyMods = 0;
+ byte [] buffer2 = new byte [1];
if (accel && ++i < text.length) {
- char [] accelText = new char [text.length - i];
- System.arraycopy (text, i, accelText, 0, accelText.length);
- buffer2 = Converter.wcsToMbcs (null, accelText, true);
- } else {
- buffer2 = new byte [1];
+ 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 ptr = OS.malloc (buffer1.length);
- OS.memmove (ptr, buffer1, buffer1.length);
+ 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, OS.Pk_KM_Alt);
+ }
int [] args = {
- OS.Pt_ARG_TEXT_STRING, ptr, 0,
+ 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 (ptr);
+ OS.free (ptr1);
+ OS.free (ptr2);
OS.free (ptr3);
/*
* Bug on Photon. When a the text is set on a menu
@@ -368,4 +450,4 @@ public void setText (String string) {
if (OS.PtWidgetIsRealized (handle)) OS.PtExtentWidget (handle);
}
-} \ No newline at end of file
+}
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
index 97348244e3..c3a29ea2cc 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.*;
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
index 0e9b4579fc..461ea7a7bb 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.photon.*;
@@ -50,6 +50,7 @@ public Point computeSize (int wHint, int hHint, boolean changed) {
}
void createHandle (int index) {
+ state |= HANDLE;
Display display = getDisplay ();
int clazz = display.PtProgress;
int parentHandle = parent.handle;
@@ -118,4 +119,4 @@ public void setSelection (int value) {
int [] args = {OS.Pt_ARG_GAUGE_VALUE, value, 0};
OS.PtSetResources (handle, args.length / 3, args);
}
-} \ No newline at end of file
+}
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
index 2f97a08506..323de08511 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.photon.*;
@@ -47,6 +47,7 @@ public Point computeSize (int wHint, int hHint, boolean changed) {
}
void createHandle (int index) {
+ state |= HANDLE;
Display display = getDisplay ();
int clazz = display.PtContainer;
int parentHandle = parent.handle;
@@ -80,6 +81,12 @@ void drawBand (int x, int y, int width, int height) {
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);
@@ -111,8 +118,8 @@ int processMouse (int info) {
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);
+// 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 */
@@ -168,12 +175,9 @@ int processMouse (int info) {
/* Compute the banding rectangle */
x += area.pos_x;
y += area.pos_y;
- int parentHandle = parent.handle;
- rect = new PhRect_t ();
- int vParent = OS.PtValidParent (handle, OS.PtContainer ());
- OS.PtCalcCanvas (vParent, rect);
- int clientWidth = rect.lr_x - rect.ul_x + 1;
- int clientHeight = rect.lr_y - rect.ul_y + 1;
+ 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);
@@ -222,4 +226,4 @@ public void removeSelectionListener(SelectionListener listener) {
eventTable.unhook (SWT.DefaultSelection,listener);
}
-} \ No newline at end of file
+}
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
index 96820ad7b6..400c24766f 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.photon.*;
@@ -50,6 +50,7 @@ public Point computeSize (int wHint, int hHint, boolean changed) {
}
void createHandle (int index) {
+ state |= HANDLE;
Display display = getDisplay ();
int clazz = display.PtSlider;
int parentHandle = parent.handle;
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
index 3b810a2ab2..586641bb58 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.photon.*;
@@ -17,6 +17,7 @@ ScrollBar (Scrollable parent, int style, int handle) {
super (parent, checkStyle (style));
this.parent = parent;
this.handle = handle;
+ state |= HANDLE;
createWidget (0);
}
@@ -40,18 +41,34 @@ public void addSelectionListener (SelectionListener listener) {
}
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_ORIENTATION, (style & SWT.HORIZONTAL) != 0 ? OS.Pt_HORIZONTAL : OS.Pt_VERTICAL, 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);
- OS.PtExtentWidget (handle);
}
public Display getDisplay () {
@@ -288,6 +305,7 @@ public void setValues (int selection, int minimum, int maximum, int thumb, int i
public void setVisible (boolean visible) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (visible == OS.PtWidgetIsRealized (handle)) return;
int [] args = {
OS.Pt_ARG_FLAGS, visible ? 0 : OS.Pt_DELAY_REALIZE, OS.Pt_DELAY_REALIZE,
};
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
index ac2121a3de..6781db28da 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.photon.*;
@@ -101,8 +101,14 @@ void resizeClientArea () {
}
void releaseWidget () {
- if (horizontalBar != null) horizontalBar.releaseWidget ();
- if (verticalBar != null) verticalBar.releaseWidget ();
+ if (horizontalBar != null) {
+ horizontalBar.releaseWidget ();
+ horizontalBar.releaseHandle ();
+ }
+ if (verticalBar != null) {
+ verticalBar.releaseWidget ();
+ verticalBar.releaseHandle ();
+ }
horizontalBar = verticalBar = null;
super.releaseWidget ();
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/SelectableItem.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/SelectableItem.java
index 7b590263a7..87acefdaef 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/SelectableItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/SelectableItem.java
@@ -1,13 +1,13 @@
package org.eclipse.swt.widgets;
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
-/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
- */
-
/**
* This class implements common behavior of TreeItem and TableItem.
*/
@@ -26,14 +26,14 @@ abstract class SelectableItem extends Item {
*/
SelectableItem(SelectableItemWidget parent, int style) {
super(parent, style);
- setParent(parent);
- addListener(SWT.Dispose, new Listener() {
- public void handleEvent(Event event) {disposeItem();}});
+ setParent(parent);
}
-/**
- * Subclasses should free resources here
- */
-void disposeItem() {
+public void dispose() {
+ if (!isValidWidget ()) return;
+ super.dispose();
+ doDispose();
+}
+void doDispose() {
setParent(null);
}
/**
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/SelectableItemWidget.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/SelectableItemWidget.java
index 0eda6178f2..384fe03089 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/SelectableItemWidget.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/SelectableItemWidget.java
@@ -1,14 +1,14 @@
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.io.*;
import java.util.*;
-
-/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
- */
/**
* This class is intended for widgets that display data of
@@ -1657,22 +1657,46 @@ void select(SelectableItem 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(SelectableItem item) {
- Event event;
-
+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
}
- event = new Event();
- event.item = item;
- notifyListeners(SWT.Selection, event);
+ 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'.
*/
@@ -2024,4 +2048,4 @@ void toggleSelectionNotify(SelectableItem item) {
selectNotify(item);
}
}
-} \ No newline at end of file
+}
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
index 46decb71bd..6e66d3a8ca 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.*;
@@ -15,7 +15,8 @@ public class Shell extends Decorations {
int shellHandle;
Display display;
int modal, blockedList;
-
+ Control lastFocus;
+
public Shell () {
this ((Display) null);
}
@@ -101,19 +102,23 @@ public Rectangle computeTrim (int x, int y, int width, int height) {
int trimWidth = width + left [0] + right [0];
int trimHeight = height + top [0] + bottom [0];
if (menuBar != null) {
- args = new int [] {OS.Pt_ARG_HEIGHT, 0, 0};
- OS.PtGetResources (menuBar.handle, args.length / 3, args);
- trimHeight += args [1];
- trimY -= args [1];
+ 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_FLAGS, OS.Pt_GETS_FOCUS, OS.Pt_GETS_FOCUS,
OS.Pt_ARG_RESIZE_FLAGS, 0, OS.Pt_RESIZE_XY_BITS,
};
shellHandle = OS.PtCreateWidget (clazz, handle, args.length / 3, args);
@@ -140,6 +145,11 @@ void createHandle (int index) {
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,
@@ -147,10 +157,8 @@ void createHandle (int index) {
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, OS.Ph_WM_ICON, OS.Ph_WM_ICON,
- OS.Pt_ARG_WINDOW_NOTIFY_FLAGS, OS.Ph_WM_FOCUS, OS.Ph_WM_FOCUS,
- OS.Pt_ARG_WINDOW_NOTIFY_FLAGS, OS.Ph_WM_MOVE, OS.Ph_WM_MOVE,
- OS.Pt_ARG_WINDOW_NOTIFY_FLAGS, OS.Ph_WM_RESIZE, OS.Ph_WM_RESIZE,
+ 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_RESIZE_FLAGS, 0, OS.Pt_RESIZE_XY_BITS,
};
@@ -159,7 +167,18 @@ void createHandle (int index) {
OS.free (titlePtr);
if (shellHandle == 0) error (SWT.ERROR_NO_HANDLES);
}
+ if ((style & SWT.NO_BACKGROUND) != 0) {
+ int [] args = new int [] {OS.Pt_ARG_FILL_COLOR, OS.Pg_TRANSPARENT, 0};
+ OS.PtSetResources(shellHandle, args.length / 3, args);
+ }
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, OS.Pt_ALL_OUTLINES,
+ };
+ 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]);
@@ -170,66 +189,6 @@ void deregister () {
WidgetTable.remove (shellHandle);
}
-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, -1);
-}
-
-public void open () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- bringToTop ();
- setVisible (true);
-}
-
-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);
-}
public Display getDisplay () {
if (display == null) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -323,16 +282,125 @@ public Point getSize () {
return new Point (width, height);
}
-void releaseHandle () {
- super.releaseHandle ();
- if (blockedList != 0) OS.PtUnblockWindows (blockedList);
- blockedList = shellHandle = 0;
+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);
+}
+
+public void open () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ 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;
+}
+
public void removeShellListener (ShellListener listener) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -443,7 +511,6 @@ public void setMenuBar (Menu 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];
- PhArea_t area = new PhArea_t ();
if (menuBar != null) {
int menuHandle = menu.handle;
args = new int [] {
@@ -451,22 +518,9 @@ public void setMenuBar (Menu menu) {
OS.Pt_ARG_FLAGS, 0, OS.Pt_DELAY_REALIZE,
};
OS.PtSetResources (menuHandle, args.length / 3, args);
- args = new int [] {OS.Pt_ARG_HEIGHT, 0, 0};
- OS.PtGetResources (menuHandle, args.length / 3, args);
- area.pos_y = (short) args [1];
- area.size_w = (short) width;
- area.size_h = (short) Math.max (0, (height - args [1]));
- OS.PtRealizeWidget (menuBar.handle);
- } else {
- area.size_w = (short) width;
- area.size_h = (short) height;
+ OS.PtRealizeWidget (menuHandle);
}
- 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 (scrolledHandle, args.length / 3, args);
- OS.free (ptr);
- resizeClientArea();
+ resizeBounds(width, height);
}
public void setMinimized (boolean minimized) {
@@ -517,6 +571,19 @@ public void setVisible (boolean visible) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
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 ? 0 : parentHandle);
+ }
+ }
switch (modal) {
case SWT.PRIMARY_MODAL:
//NOT DONE: should not disable all windows
@@ -530,6 +597,21 @@ public void setVisible (boolean visible) {
}
}
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 ();
}
@@ -538,4 +620,4 @@ int topHandle () {
return shellHandle;
}
-} \ No newline at end of file
+}
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
index b21f1b5831..b371b20828 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.photon.*;
@@ -48,6 +48,7 @@ public Point computeSize (int wHint, int hHint, boolean changed) {
}
void createHandle (int index) {
+ state |= HANDLE;
Display display = getDisplay ();
int clazz = display.PtScrollbar;
int parentHandle = parent.handle;
@@ -233,4 +234,4 @@ public void setValues (int selection, int minimum, int maximum, int thumb, int i
OS.PtSetResources (handle, args.length / 3, args);
}
-} \ No newline at end of file
+}
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
index d69f35ad78..dd6ef94491 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.*;
@@ -89,6 +89,7 @@ public Rectangle computeTrim (int x, int y, int width, int height) {
}
void createHandle (int index) {
+ state |= HANDLE;
Display display = getDisplay ();
int clazz = display.PtPanelGroup;
int parentHandle = parent.handle;
@@ -300,7 +301,10 @@ void releaseWidget () {
int count = args [2];
for (int i=0; i<count; i++) {
TabItem item = items [i];
- if (!item.isDisposed ()) item.releaseWidget ();
+ if (!item.isDisposed ()) {
+ item.releaseWidget ();
+ item.releaseHandle ();
+ }
}
items = null;
super.releaseWidget ();
@@ -357,4 +361,4 @@ public void setSelection (TabItem [] items) {
}
}
-} \ No newline at end of file
+}
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
index e41dde1451..9c733f9677 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.*;
@@ -53,11 +53,6 @@ public String getToolTipText () {
return toolTipText;
}
-public boolean isDisposed () {
- //NOT DONE - should have a handle or state flag
- return parent == null;
-}
-
void releaseChild () {
super.releaseChild ();
parent.destroyItem (this);
@@ -67,6 +62,7 @@ void releaseWidget () {
super.releaseWidget ();
control = null;
parent = null;
+ toolTipText = null;
}
public void setControl (Control control) {
@@ -132,4 +128,4 @@ public void setToolTipText (String string) {
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
toolTipText = string;
}
-} \ No newline at end of file
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Table.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Table.java
index c0897e483c..5cd4dda148 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Table.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Table.java
@@ -1,18 +1,36 @@
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.*;
-
-/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
- */
-/**
- * This class display rows of items arranged in one or more
- * columns. Items can be selected, columns can be resized.
+/**
+ * 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 /*final*/ class Table extends SelectableItemWidget {
private static final int COLUMN_RESIZE_OFFSET = 7; // offset from the start and end of each
@@ -41,9 +59,32 @@ public /*final*/ class Table extends SelectableItemWidget {
// Fix for 1FUSJY5
private int dotsWidth = -1; // width of the static String dots (see above)
/**
- * Create a new instance of Table.
- * @param parent - the parent window of the new instance
- * @param style - window style for the new instance
+ * 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
@@ -101,12 +142,33 @@ void addItem(TableItem item, int index) {
}
addedItem(item, index);
}
-/**
-* Adds the listener to receive events.
-* <p>
-*
-* @param listener the 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.
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -172,6 +234,7 @@ void columnMouseDoubleClick(Event event) {
TableItem hitItem;
TableColumn hitColumn = getColumnAtX(event.x);
Event columnDblClickEvent;
+ boolean isFullSelection = (getStyle() & SWT.FULL_SELECTION) != 0;
if (isFocusControl() == false) {
setFocus(); // focus proxy gets focus here because it's the first child of the receiver
@@ -180,7 +243,7 @@ void columnMouseDoubleClick(Event event) {
itemIndex = (event.y - getHeaderHeight()) / itemHeight + getTopIndex();
hitItem = (TableItem) getVisibleItem(itemIndex);
if (hitItem != null &&
- hitColumn.getIndex() == TableColumn.FIRST) {
+ (hitColumn.getIndex() == TableColumn.FIRST || isFullSelection)) {
if (hitItem.isSelectionHit(event.x) == true) {
columnDblClickEvent = new Event();
columnDblClickEvent.item = hitItem;
@@ -234,10 +297,6 @@ void columnMouseMove(Event event) {
setColumnResizeCursor(false);
}
}
-/**
- * Answer the size of the receiver needed to display all or
- * the first 50 items whichever is less.
- */
public Point computeSize(int wHint, int hHint, boolean changed) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -280,11 +339,22 @@ public Point computeSize(int wHint, int hHint, boolean changed) {
}
return size;
}
-/**
- * Deselect the items identified by the indices stored
- * in 'indices'.
- * A SWT.Selection event will not be sent.
- * @param indices - indices of the items to deselect
+/**
+ * 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[]) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -304,10 +374,17 @@ public void deselect(int indices[]) {
setLastSelection(item, false);
}
}
-/**
- * Deselect the item identified by 'index'.
- * A SWT.Selection event will not be sent.
- * @param index - index of the item to deselect
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -319,12 +396,20 @@ public void deselect(int index) {
setLastSelection(item, false);
}
}
-/**
- * Deselect a range of items starting at index 'start'
- * and stopping at index 'end'. Indices that are out of
- * range are ignored. Indexing is zero based.
- * @param start - the start of the range
- * @param end - the end of the range
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -341,8 +426,13 @@ public void deselect(int start, int end) {
setLastSelection(item, false);
}
}
-/**
- * Deselect all items of the receiver.
+/**
+ * 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() {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -518,8 +608,25 @@ void focusOut(Event event) {
event.widget = this; // the focus event is never sent to the table itself but only to the focus widget
notifyListeners(event.type, event); // make sure that listeners of the table get the focus event, too
}
-/**
- * Answer the TableColumn at 'index'.
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -562,8 +669,22 @@ TableColumn getColumnAtX(int xPosition) {
}
return hitColumn;
}
-/**
- * Answer the number of columns in the receiver.
+/**
+ * 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() {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -595,9 +716,25 @@ Cursor getColumnResizeCursor() {
int getColumnResizeX() {
return columnResizeX;
}
-/**
- * Answer an Array containing all columns of receiver except
- * the fill column to the right of all content columns.
+/**
+ * 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() {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -650,16 +787,14 @@ TableColumn getFillColumn() {
Control getFocusWindow() {
return focusProxy;
}
-/**
-* Gets the width of a grid line.
-* <p>
-* @return the width of a grid line
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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 () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -684,10 +819,22 @@ int getHeaderHeight() {
}
return height;
}
-/**
- * Answer whether the header is visible.
- * @return
- * true = header is visible. false = header is not visible
+/**
+ * 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() {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -724,9 +871,20 @@ int getIndex(SelectableItem item) {
}
return index;
}
-/**
- * Answer the TableItem located at 'index' in the receiver.
- * @param index - location of the TableItem object to return
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -738,9 +896,21 @@ public TableItem getItem(int index) {
return (TableItem) getVisibleItem(index);
}
-/**
- * Return the item at the specified position in the widget
- * Return null if the position is outside the widget or in the header widget.
+/**
+ * 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();
@@ -759,8 +929,15 @@ public TableItem getItem(Point point) {
}
return item;
}
-/**
- * Answer the number of items in the receiver.
+/**
+ * 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);
@@ -777,13 +954,16 @@ int getItemCountWhole() {
return clientAreaHeight / 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.
+/**
+ * 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() {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -797,8 +977,21 @@ public int getItemHeight() {
int getItemPadding() {
return getGridLineWidth() + getDisplay().textHighlightThickness + 1;
}
-/**
- * Answer all items of the receiver as an Array.
+/**
+ * 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() {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -815,11 +1008,22 @@ public TableItem [] getItems() {
Vector getItemVector() {
return items;
}
-/**
- * Answer whether the receiver is drawing grid lines.
- * @return
- * true = receiver draws grid lines
- * false = receiver does not draw grid lines
+/**
+ * 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() {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -918,10 +1122,21 @@ int [] getResizeRedrawX(int columnIndex, int columnWidth) {
}
return resizeRedrawX;
}
-/**
- * Answer the selected items of the receiver.
- * @return an Array of TableItems containing the selected items.
- * An empty Array if no items are selected.
+/**
+ * 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() {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -934,8 +1149,15 @@ public TableItem [] getSelection() {
return selectionArray;
}
-/**
- * Answer the number of selected items in the receiver.
+/**
+ * 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() {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -964,8 +1186,16 @@ Point getFullSelectionExtent(TableItem item) {
}
return selectionExtent;
}
-/**
- * Answer the index of the first selected item of the receiver.
+/**
+ * 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);
@@ -977,10 +1207,20 @@ public int getSelectionIndex() {
}
return index;
}
-/**
- * Answer the indices of the selected items of the receiver.
- * @return an Array containing the indices of the selected items.
- * An empty Array if no items are selected.
+/**
+ * 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() {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -993,11 +1233,17 @@ public int [] getSelectionIndices() {
}
return indices;
}
-/**
- * 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.
+/**
+ * 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() {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -1096,9 +1342,6 @@ void handleEvents(Event event) {
boolean hasFirstColumnImage() {
return firstColumnImage;
}
-/**
- * Answer whether the receiver has the input focus.
- */
public boolean isFocusControl() {
return hasColumnFocus;
}
@@ -1137,9 +1380,22 @@ void headerMouseMove(Event event) {
update(); // looks better if resize line is drawn immediately
}
}
-/**
- * Answer the index of 'column' in the receiver or -1 if 'column'
- * does not exist in the receiver.
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -1150,9 +1406,22 @@ public int indexOf(TableColumn column) {
}
return internalGetColumnVector().indexOf(column);
}
-/**
- * Answer the index of 'item' in the receiver or -1 if 'item'
- * does not exist in the receiver.
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -1170,7 +1439,7 @@ void initialize() {
columns = new Vector();
setItemVector(new Vector());
focusProxy = new Button(this, SWT.NULL);
- focusProxy.setBounds(0, 0, 0, 0); // make the focus proxy invisible
+ focusProxy.setBounds(-100, -100, 0, 0); // make the focus proxy invisible
tableHeader = new Header(this);
tableHeader.setVisible(false); // SWT table header is invisible by default, too
fillColumn = TableColumn.createFillColumn(this);
@@ -1331,11 +1600,18 @@ boolean isColumnResize(Event event) {
boolean isColumnResizeStarted() {
return (getResizeColumn() != null);
}
-/**
- * Answer whether the item identified by 'index' is selected.
- * @return
- * true=item identified by 'index' is selected
- * false=item identified by 'index' is not selected.
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -1545,10 +1821,22 @@ void reindexColumns(int startIndex) {
column.setIndex(i);
}
}
-/**
- * Remove the items identified by the indices stored in
- * 'indices' from the receiver.
- * @param indices - indices of the items to dispose
+/**
+ * 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[]) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -1576,9 +1864,22 @@ public void remove(int indices[]) {
}
}
}
-/**
- * Remove the item identified by 'index'.
- * @param index - index of the item to dispose
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -1592,13 +1893,24 @@ public void remove(int index) {
error(SWT.ERROR_ITEM_NOT_REMOVED);
}
}
-/**
- * Remove a range of items starting at index 'start' and
- * stopping at index 'end'.
- * This operation will fail when the index is out of range
- * Indexing is zero based.
- * @param start - the start of the range
- * @param end - the end of the range
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -1615,8 +1927,13 @@ public void remove(int start, int end) {
}
}
}
-/**
- * Remove all items of the receiver.
+/**
+ * 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() {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -1718,13 +2035,23 @@ void removeItem(TableItem item) {
}
}
}
-/**
-* Removes the listener.
-* <p>
-*
-* @param listener the 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -1886,11 +2213,22 @@ void scrollVerticalRemovedItem(int index) {
0, destY + itemHeight, // source x, y
clientArea.width, clientArea.height, true);
}
-/**
- * Select the items identified by the indices stored in
- * 'indices'.
- * A SWT.Selection event will not be sent.
- * @param indices - indices of the items to select
+/**
+ * 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[]) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -1916,10 +2254,17 @@ public void select(int indices[]) {
setLastSelection(item, false);
}
}
-/**
- * Select the item identified by 'index'.
- * A SWT.Selection event will not be sent.
- * @param index - index of the item to select
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -1934,12 +2279,19 @@ public void select(int index) {
setLastSelection(item, false);
}
}
-/**
- * Select a range of items starting at index 'start' and
- * stopping at index 'end'. Indices that are out of range
- * are ignored. Indexing is zero based.
- * @param start - the start of the range
- * @param end - the end of the range
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -1967,11 +2319,13 @@ public void select(int start, int end) {
setLastSelection(item, false);
}
}
-/**
- * Select all items of the receiver if it is in multiple
- * selection mode.
- * A SWT.Selection event will not be sent.
- * Do nothing if the receiver is in single selection mode.
+/**
+ * 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() {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -2060,10 +2414,6 @@ void setFirstColumnWidth(TableItem item) {
}
}
}
-/**
- * The font is changing. Trigger a recalculation of the item
- * height using all items of the receiver.
- */
public void setFont(Font font) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -2082,10 +2432,21 @@ public void setFont(Font font) {
setRedraw(true); // re-enable redraw
getHeader().setFont(font);
}
-/**
- * Set whether or not the header is visible.
- * @param headerVisible -
- * true = header is visible. false = header is not visible
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -2110,12 +2471,21 @@ public void setHeaderVisible(boolean headerVisible) {
void setItemVector(Vector newVector) {
items = newVector;
}
-/**
- * Set whether the receiver is drawing grid lines to
- * 'drawGridLines'.
- * @param drawGridLines -
- * true = receiver draws grid lines
- * false = receiver does not draw grid lines
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -2126,13 +2496,6 @@ public void setLinesVisible(boolean drawGridLines) {
redraw();
}
}
-/**
- * Set whether the receiver and it's children should be
- * drawn or not.
- * @param redraw -
- * true = redraw the receiver and its children
- * false = do not draw the receiver or its children
- */
public void setRedraw(boolean redraw) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -2149,22 +2512,23 @@ public void setRedraw(boolean redraw) {
void setResizeColumn(TableColumn column) {
resizeColumn = column;
}
-/**
-* Sets the selection.
-* <p>
-* The previous selection is cleared
-* before new items are selected.
-*
-* @see Table#deselectAll()
-* @see Table#select(int [])
-*
-* @param indices the indices of the items
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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 listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -2183,11 +2547,23 @@ public void setSelection(int [] indices) {
deselectAllExcept(keepSelected);
select(indices);
}
-/**
- * Select the items stored in 'items'.
- * A SWT.Selection event is not going to be sent.
- * @param selectionItems - Array containing the items that should
- * be selected
+/**
+ * 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 Table#deselectAll()
+ * @see Table#select(int)
*/
public void setSelection(TableItem selectionItems[]) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -2198,10 +2574,19 @@ public void setSelection(TableItem selectionItems[]) {
}
setSelectableSelection(selectionItems);
}
-/**
- * Set the selection to the item identified by 'index'.
- * SWT.Selection events are not going to be sent.
- * @param index - index of the item that should be selected
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -2210,12 +2595,20 @@ public void setSelection(int index) {
deselectAllExcept(getVisibleItem(index));
select(index);
}
-/**
- * Set the selection to a range of items starting at index
- * 'start' and stopping at index 'end'. Indices that are out
- * of range are ignored. Indexing is zero based.
- * @param start - the start of the range
- * @param end - the end of the range
+/**
+ * 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 (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -2231,14 +2624,17 @@ public void setSelection(int start, int end) {
deselectAllExcept(keepSelected);
select(start, end);
}
-/**
- * Scroll the item at position 'index' to the top of the receiver.
- * If the scroll operation would result in empty space being
- * displayed below the last item of the receiver, the last item is
- * scrolled into view. This results in the specified item not being
- * displayed at the top of the receiver but after the top item.
- * @param index - 0-based index of the item that should be
- * displayed at the top of the receiver's client area.
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -2267,11 +2663,22 @@ void setTopIndexNoScroll(int index, boolean adjustScrollbar) {
super.setTopIndexNoScroll(index, adjustScrollbar);
moveColumnsVertical();
}
-/**
- * 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.
+/**
+ * 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 listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -2282,11 +2689,20 @@ public void showItem(TableItem item) {
}
showSelectableItem(item);
}
-/**
- * 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.
+/**
+ * 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() {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -2358,4 +2774,4 @@ String trimItemText(String text, int maxWidth, GC gc) {
return text;
}
-} \ No newline at end of file
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/TableColumn.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/TableColumn.java
index 55c9ba604c..dc981d2a72 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/TableColumn.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/TableColumn.java
@@ -1,17 +1,25 @@
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.*;
-
-/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
- */
-/**
- * A TableColumn stores such data as column label, label alignmentand size.
- * It routes paint requests to the corresponding table item.
+/**
+ * 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 /*final*/ class TableColumn extends Item {
static final int FIRST = 0; // index of the first column
@@ -67,19 +75,25 @@ public TableColumn(Table parent, int style, int index) {
public void handleEvent(Event event) {disposeColumn();}
});
}
-/**
-* 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
-*/
+/**
+ * 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);
@@ -88,19 +102,30 @@ public void addControlListener(ControlListener listener) {
addListener (SWT.Resize,typedListener);
addListener (SWT.Move,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
-*/
+/**
+ * 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);
@@ -154,20 +179,18 @@ static TableColumn createFillColumn(Table parent) {
void disposeColumn() {
getParent().removeColumn(this);
}
-/**
-* Gets the alignment.
-* <p>
-* The alignment of a widget controls the position of the
-* text or image in the widget. The alignment may be one
-* of LEFT, RIGHT or CENTER.
-*
-* @return the alignment
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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);
@@ -183,9 +206,6 @@ public int getAlignment () {
Rectangle getBounds() {
return new Rectangle(bounds.x, bounds.y, bounds.width, bounds.height); // copy the object to prevent changes
}
-/**
- * Gets the Display.
- */
public Display getDisplay() {
if (parent == null) { // access parent field directly to prevent endless recursion
error(SWT.ERROR_WIDGET_DISPOSED);
@@ -199,8 +219,15 @@ public Display getDisplay() {
int getIndex() {
return index;
}
-/**
- * Answer the parent widget of the receiver.
+/**
+ * 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);
@@ -208,32 +235,34 @@ public Table getParent() {
return parent;
}
-/**
-* Gets the resize attribute.
-* <p>
-* @return the resize attribute
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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);
return resize;
}
-/**
-* Gets the width.
-* <p>
-* @return the width
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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);
@@ -256,17 +285,17 @@ void internalSetBounds(Rectangle newBounds) {
boolean isDefaultWidth() {
return isDefaultWidth;
}
-/**
-* Packs the widget.
-* <p>
-* Packing a widget causes it to be resized to the
-* preferred size for 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
-*/
+/**
+ * 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);
@@ -289,19 +318,23 @@ void paint(TableItem item, GC gc, int yPosition) {
item.paint(gc, paintPosition, this);
}
-/**
-* 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
-*/
+/**
+ * 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);
@@ -310,19 +343,23 @@ public void removeControlListener (ControlListener listener) {
eventTable.unhook (SWT.Move, listener);
eventTable.unhook (SWT.Resize, 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
-*/
+/**
+ * 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);
@@ -333,20 +370,18 @@ public void removeSelectionListener(SelectionListener listener) {
removeListener(SWT.Selection, listener);
removeListener(SWT.DefaultSelection, listener);
}
-/**
-* Sets the alignment.
-* <p>
-* The alignment of a widget controls the position of the
-* text or image in the widget. The alignement may be one
-* of LEFT, RIGHT or CENTER.
-*
-* @param alignment the new alignment
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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);
@@ -396,25 +431,24 @@ void setDefaultWidth(boolean isDefaultWidth) {
void setIndex(int newIndex) {
this.index = newIndex;
}
-/**
-* Sets the resize attribute.
-* <p>
-* @param resizee the resize attribute
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
this.resize = resize;
}
-/**
- * Set the text of the receiver to 'text'.
- */
public void setText(String newText) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -428,16 +462,16 @@ public void setText(String newText) {
getParent().getHeader().redraw(index);
}
}
-/**
-* Sets the width.
-* <p>
-* @param width the width
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+/**
+ * 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);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/TableItem.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/TableItem.java
index 6919d84766..6da0ba377e 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/TableItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/TableItem.java
@@ -1,18 +1,26 @@
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.*;
-/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
- */
-
/**
- * A table item is a selectable user interface object
+ * Instances of this class represent a selectable user interface object
* that represents an item in a table.
- * Table items can consist of multiple columns called sub items.
+ * <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 /*final*/ class TableItem extends SelectableItem {
private static final int FIRST_COLUMN_IMAGE_INDENT = 2; // Space in front of image - first column only
@@ -87,17 +95,20 @@ static Table checkNull(Table table) {
protected void checkSubclass () {
if (!isValidSubclass ()) error (SWT.ERROR_INVALID_SUBCLASS);
}
-/**
- * The receiver is destroyed. Remove it from its parent widget.
- */
-void disposeItem() {
- getParent().removeItem(this);
+public void dispose() {
+ if (!isValidWidget ()) return;
+ Table parent = getParent();
+ parent.removeItem(this);
+ super.dispose();
+}
+void doDispose() {
dataLabels = null;
trimmedLabels = null;
images = null;
selectionExtent = null;
- super.disposeItem();
+ super.doDispose();
}
+
/**
* Draw the image of the receiver for column 'index' at
* 'destinationPosition' using 'gc'.
@@ -170,15 +181,17 @@ void drawText(String label, GC gc, Point position, int index) {
}
/**
-* Gets the item bounds at an index
-* <p>
-* @return the item bounds
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+ * 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);
@@ -216,9 +229,16 @@ public Rectangle getBounds(int index) {
return itemBounds;
}
/**
- * Return whether or not the receiver is checked.
- * Always return false if the parent of the receiver does not
- * have the CHECK style.
+ * 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() {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -242,9 +262,6 @@ int getCheckboxXPosition() {
Vector getDataLabels() {
return dataLabels;
}
-/**
- * Answer the display of the receiver's parent widget.
- */
public Display getDisplay() {
return super.getDisplay();
}
@@ -279,14 +296,16 @@ int getDotStartX(int columnIndex, int columnWidth) {
return dotStartX;
}
/**
- * Gets the grayed state.
- * <p>
- * @return the item grayed state.
+ * 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 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>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if 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);
@@ -294,9 +313,6 @@ public boolean getGrayed() {
return super.getGrayed();
}
-/**
- * Answer the item image of the first column.
- */
public Image getImage() {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -304,9 +320,11 @@ public Image getImage() {
return getImage(0);
}
/**
- * Answer the item image of the column identified by 'columnIndex' or
+ * 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 answered
+ *
+ * @param columnIndex - the column whose image should be returned
+ * @return the item image
*/
public Image getImage(int columnIndex) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -321,15 +339,18 @@ public Image getImage(int columnIndex) {
return image;
}
/**
-* Gets the image bounds at an index
-* <p>
-* @return the item icon's bounds
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+ * 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);
@@ -353,15 +374,15 @@ public Rectangle getImageBounds(int index) {
return imageBounds;
}
/**
-* Gets the image indent.
-* <p>
-* @return the indent
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+ * 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() == false) error(SWT.ERROR_THREAD_INVALID_ACCESS);
if (isValidWidget() == false) error(SWT.ERROR_WIDGET_DISPOSED);
@@ -462,7 +483,14 @@ int getMaxTextWidth(int columnIndex, int columnWidth) {
return columnWidth - itemWidth;
}
/**
- * Answer the parent widget of the receiver.
+ * 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);
@@ -510,9 +538,6 @@ Point getSelectionExtent() {
int getSelectionX() {
return getImageStopX(TableColumn.FIRST) + getParent().getHorizontalOffset();
}
-/**
- * Answer the item text of the first column.
- */
public String getText() {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -520,10 +545,11 @@ public String getText() {
return getText(0);
}
/**
- * Answer the item tezt of the column identified by 'columnIndex'.
- * Answer null if no text has been set for that column.
- * @param columnIndex - the column whose text should be answered.
- * null if no text has been set for that column.
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -653,7 +679,7 @@ void insertColumn(TableColumn column) {
}
/**
* Sets the image at an index.
- * <p>
+ *
* @param image the new image (or null)
*
* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
@@ -681,7 +707,6 @@ void internalSetImage(int columnIndex, Image 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
@@ -846,8 +871,18 @@ void reset(int index) {
}
}
/**
-* Warning: API under construction.
-*/
+ * Sets the image for multiple columns in the Table.
+ *
+ * @param strings the array of new images
+ *
+ * @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 setImage(Image [] images) {
if (!isValidThread()) error(SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget()) error(SWT.ERROR_WIDGET_DISPOSED);
@@ -863,14 +898,18 @@ public void setImage(Image [] images) {
}
}
/**
- * Sets the image at an index.
- * <p>
- * @param image the new image (or null)
+ * Sets the receiver's image at a column.
*
- * @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
- * when called from the wrong thread
- * @exception SWTError(ERROR_WIDGET_DISPOSED)
- * when the widget has been disposed
+ * @param index the column index
+ * @param string the new image
+ *
+ * @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 setImage(int columnIndex, Image image) {
if (!isValidThread()) error(SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -880,11 +919,6 @@ public void setImage(int columnIndex, Image image) {
internalSetImage(columnIndex, image);
}
}
-/**
- * Set the item image of the first column to 'image'.
- * @param image - the item image of the first column. Image
- * will be removed if this is null.
- */
public void setImage(Image image) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -892,15 +926,16 @@ public void setImage(Image image) {
setImage(0, image);
}
/**
-* Sets the image indent.
-* <p>
-* @param indent the new indent
-*
-* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
+ * 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);
@@ -917,7 +952,17 @@ public void setImageIndent(int indent) {
}
}
/**
- * Warning: API under construction.
+ * 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);
@@ -937,23 +982,19 @@ public void setText(String [] strings) {
}
}
/**
-* 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(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
-*/
+ * 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 columnIndex, String string) {
if (!isValidThread()) error(SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget()) error(SWT.ERROR_WIDGET_DISPOSED);
@@ -965,11 +1006,6 @@ public void setText (int columnIndex, String string) {
internalSetText(columnIndex, string);
}
}
-/**
- * Set the item text of the first column to 'text'.
- * @param text - the item text of the first column. May be null if the
- * text label should be removed.
- */
public void setText(String text) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -997,8 +1033,14 @@ void setTrimmedText(String label, int columnIndex) {
}
}
/**
- * Set the checked state to 'checked' if the parent of the
- * receiver has the CHECK style.
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -1007,14 +1049,14 @@ public void setChecked(boolean checked) {
super.setChecked(checked);
}
/**
- * Sets the grayed state.
- * <p>
- * @param grayed the new grayed state.
+ * Sets the grayed state of the receiver.
+ *
+ * @param checked 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>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
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
index 407924fdc7..d14ced445a 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.*;
@@ -15,7 +15,7 @@ public class Text extends Scrollable {
char echoCharacter;
boolean ignoreChange;
String hiddenText;
- int lastModifiedText;
+ int tabs, lastModifiedText;
PtTextCallback_t textVerify;
public static final int LIMIT;
@@ -79,12 +79,15 @@ public void clearSelection () {
OS.PtTextSetSelection (handle, new int [] {0}, new int [] {0});
}
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,
@@ -96,6 +99,7 @@ void createHandle (int index) {
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,
@@ -108,6 +112,12 @@ void createHandle (int index) {
createScrollBars();
}
+void createWidget (int index) {
+ super.createWidget (index);
+// doubleClick = true;
+ setTabStops (tabs = 8);
+}
+
public void addModifyListener (ModifyListener listener) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -173,6 +183,21 @@ public void cut () {
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);
+}
+
public int getCaretLineNumber () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -267,6 +292,11 @@ public int getLineHeight () {
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));
+}
+
public Point getSelection () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -305,8 +335,19 @@ public String getSelectionText () {
public int getTabs () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
- //NOT DONE - NOT NEEDED
- return 0;
+ 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;
}
public String getText (int start, int end) {
@@ -363,9 +404,6 @@ public int getTopPixel () {
void hookEvents () {
super.hookEvents ();
int windowProc = getDisplay ().windowProc;
- if ((style & SWT.MULTI) != 0) {
- OS.PtAddFilterCallback (handle, OS.Ph_EV_KEY, windowProc, SWT.KeyDown);
- }
OS.PtAddCallback (handle, OS.Pt_CB_MODIFY_VERIFY, windowProc, SWT.Verify);
OS.PtAddCallback (handle, OS.Pt_CB_TEXT_CHANGED, windowProc, SWT.Modify);
}
@@ -404,6 +442,24 @@ public void paste () {
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);
@@ -478,12 +534,27 @@ int processVerify (int info) {
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;
- }
+ if (lastModifiedText != 0) OS.free (lastModifiedText);
+ lastModifiedText = 0;
+ hiddenText = null;
+ textVerify = null;
}
public void removeModifyListener (ModifyListener listener) {
@@ -553,6 +624,11 @@ public void setEditable (boolean editable) {
OS.PtSetResources(handle, args.length / 3, args);
}
+public void setFont (Font font) {
+ super.setFont (font);
+ setTabStops (tabs);
+}
+
public void setSelection (int position) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -577,8 +653,17 @@ public void setTabs (int tabs) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
if (tabs < 0) return;
+ setTabStops (this.tabs = tabs);
+}
- //NOT DONE - NOT NEEDED
+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);
}
public void setText (String string) {
@@ -616,4 +701,15 @@ public void showSelection () {
//NOT DONE - NOT NEEDED
}
-} \ No newline at end of file
+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;
+}
+
+}
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
index 5b61c7394e..707d5df752 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.photon.*;
@@ -15,6 +15,20 @@ public /*final*/ class ToolBar extends Composite {
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) {
/*
@@ -52,10 +66,13 @@ public Point computeSize (int wHint, int hHint, boolean changed) {
}
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);
@@ -146,10 +163,11 @@ void releaseWidget () {
ToolItem item = items [i];
if (item != null && !item.isDisposed ()) {
item.releaseWidget ();
+ item.releaseHandle ();
}
}
items = null;
super.releaseWidget ();
}
-} \ No newline at end of file
+}
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
index d8e1d10127..305bfc6873 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.*;
@@ -15,7 +15,9 @@ public /*final*/ class ToolItem extends Item {
ToolBar parent;
Control control;
String toolTipText;
+ int toolTipHandle;
Image hotImage, disabledImage;
+ int button, arrow;
public ToolItem (ToolBar parent, int style) {
this(parent, style, parent.getItemCount ());
@@ -44,7 +46,32 @@ 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;
@@ -57,6 +84,30 @@ void createHandle (int index) {
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;
@@ -64,7 +115,7 @@ void createHandle (int index) {
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 = OS.PtCreateWidget (OS.PtButton (), parentHandle, args.length / 3, args);
+ handle = button = OS.PtCreateWidget (OS.PtButton (), parentHandle, args.length / 3, args);
}
if (handle == 0) error (SWT.ERROR_NO_HANDLES);
if (index != count) {
@@ -87,6 +138,14 @@ void createHandle (int index) {
}
}
+void deregister () {
+ super.deregister ();
+ if ((style & SWT.DROP_DOWN) != 0) {
+ WidgetTable.remove (button);
+ WidgetTable.remove (arrow);
+ }
+}
+
public Rectangle getBounds () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -158,8 +217,13 @@ public int getWidth () {
void hookEvents () {
super.hookEvents ();
+ if ((style & SWT.SEPARATOR) != 0) return;
int windowProc = getDisplay ().windowProc;
- OS.PtAddCallback (handle, OS.Pt_CB_ACTIVATE, windowProc, SWT.Selection);
+ 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);
+ }
}
public boolean isEnabled () {
@@ -168,6 +232,41 @@ public boolean isEnabled () {
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);
@@ -188,17 +287,31 @@ int processSelection (int info) {
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 ();
parent = null;
control = null;
hotImage = null;
disabledImage = null;
+ toolTipText = null;
}
public void removeSelectionListener(SelectionListener listener) {
@@ -261,7 +374,7 @@ public void setImage (Image image) {
if (image != null) {
imageHandle = copyPhImage (image.handle);
int [] args = {OS.Pt_ARG_TEXT_STRING, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
+ 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;
}
@@ -269,8 +382,20 @@ public void setImage (Image image) {
OS.Pt_ARG_LABEL_IMAGE, imageHandle, 0,
OS.Pt_ARG_LABEL_TYPE, type, 0
};
- OS.PtSetResources (handle, args.length / 3, args);
+ 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);
+ }
+ }
}
public void setSelection (boolean selected) {
@@ -293,7 +418,7 @@ public void setText (String string) {
ptr = OS.malloc (buffer.length);
OS.memmove (ptr, buffer, buffer.length);
int [] args = {OS.Pt_ARG_LABEL_IMAGE, 0, 0};
- OS.PtGetResources (handle, args.length / 3, args);
+ OS.PtGetResources (button, args.length / 3, args);
if (args [1] != 0) type = OS.Pt_TEXT_IMAGE;
else type = OS.Pt_Z_STRING;
}
@@ -301,8 +426,20 @@ public void setText (String string) {
OS.Pt_ARG_TEXT_STRING, ptr, 0,
OS.Pt_ARG_LABEL_TYPE, type, 0,
};
- OS.PtSetResources (handle, args.length / 3, args);
+ 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);
+ }
+ }
}
public void setToolTipText (String string) {
@@ -322,4 +459,4 @@ public void setWidth (int width) {
control.setBounds (getBounds ());
}
}
-} \ No newline at end of file
+}
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
index 13657ad4b0..9870e1603c 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.photon.*;
@@ -43,6 +43,44 @@ public void close () {
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
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;
}
@@ -60,38 +98,103 @@ public boolean getStippled () {
public boolean open () {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
-// int handle = parent.handle;
- PhRect_t r = new PhRect_t ();
- OS.PhWindowQueryVisible (OS.Ph_QUERY_GRAPHICS, 0, 1, r);
- int width = (short) (r.lr_x - r.ul_x + 1);
- int height = (short) (r.lr_y - r.ul_y + 1);
+ 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, 200 /*width*/, 0,
- OS.Pt_ARG_HEIGHT, 200 /*height*/, 0,
+ OS.Pt_ARG_WIDTH, 0, 0,
+ OS.Pt_ARG_HEIGHT, 0, 0,
OS.Pt_ARG_REGION_OPAQUE, 0, ~0,
-// OS.Pt_ARG_REGION_SENSE, OS.Ph_EV_BUT_PRESS | OS.Ph_EV_DRAG, ~0,
-// OS.Pt_ARG_FILL_COLOR, OS.Pg_TRANSPARENT, 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);
- PhRect_t rect1 = new PhRect_t ();
- for (int i=0; i<rectangles.length; i++) {
- Rectangle rect = rectangles [i];
- PhRect_t rect2 = new PhRect_t ();
- rect2.ul_x = (short) rect.x;
- rect2.ul_y = (short) rect.y;
- rect2.lr_x = (short) (rect.x + rect.width - 1);
- rect2.lr_y = (short) (rect.y + rect.height - 1);
- if (i == 0) rect1 = rect2;
- OS.PhRectUnion (rect1, rect2);
+ 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.
+ */
+ 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);
}
- rect1.ul_x = rect1.ul_y = 10;
- rect1.lr_x = rect1.lr_y = 100;
- int result = OS.PhInitDrag (rid, OS.Ph_DRAG_KEY_MOTION | OS.Ph_TRACK_DRAG, rect1, null, input_group, null, null, null, null /*pos*/, null);
- return result == 0;
+ drawRectangles ();
+ tracking = false;
+ OS.PtDestroyWidget (handle);
+ return !cancelled;
+}
+void releaseWidget () {
+ super.releaseWidget ();
+ parent = null;
+ display = null;
+ rectangles = null;
}
public void removeControlListener (ControlListener listener) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -112,4 +215,4 @@ public void setStippled (boolean stippled) {
this.stippled = stippled;
}
-} \ No newline at end of file
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Tree.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Tree.java
index 463f425b91..84478209ba 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Tree.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Tree.java
@@ -1,19 +1,37 @@
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.*;
-
-/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
- */
-/**
- * Displays a hierarchy of items that can be selected.
- * Sub hierarchies can be expanded and collapsed.
+/**
+ * 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 /*final*/ class Tree extends SelectableItemWidget {
// These constants are used internally for item hit test on mouse click
@@ -39,9 +57,33 @@ public /*final*/ class Tree extends SelectableItemWidget {
// have it static. Initialized in c'tor and freed in dispose();
Rectangle hierarchyIndicatorRect = null; // bounding rectangle of the hierarchy indication image (plus/minus)
-/**
- * Create a new instance of the receiver with 'parent'
- * as its parent 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 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));
@@ -59,13 +101,32 @@ void addItem(TreeItem item, int index) {
}
getRoot().add(item, index);
}
-/**
-* Adds the listener to receive events.
-* <p>
-*
-* @param listener the 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.
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -78,13 +139,25 @@ public void addSelectionListener(SelectionListener listener) {
addListener(SWT.Selection, typedListener);
addListener(SWT.DefaultSelection, typedListener);
}
-/**
-* Adds the listener to receive events.
-* <p>
-*
-* @param listener the listener
-*
-*/
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -271,10 +344,6 @@ void collapseNoRedraw(TreeItem item) {
item.internalSetExpanded(false);
}
-/**
- * Answer the size of the receiver needed to display all or
- * the first 50 items whichever is less.
- */
public Point computeSize(int wHint, int hHint, boolean changed) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -313,8 +382,13 @@ public Point computeSize(int wHint, int hHint, boolean changed) {
}
return size;
}
-/**
- * Deselect all items of the receiver.
+/**
+ * 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() {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -446,12 +520,12 @@ void expand(TreeItem item, boolean notifyListeners) {
if (nestedExpand == false) {
setExpandingItem(item);
}
- scrollForExpand(item);
- item.internalSetExpanded(true);
if (notifyListeners == true) {
event.item = item;
notifyListeners(SWT.Expand, event);
}
+ scrollForExpand(item);
+ item.internalSetExpanded(true);
// redraw hierarchy image
item.redrawExpanded(item.getVisibleIndex() - getTopIndex());
calculateVerticalScrollbar();
@@ -554,8 +628,18 @@ int getIndex(SelectableItem item) {
}
return index;
}
-/**
- * Answer the number of root items.
+/**
+ * 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() {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -563,13 +647,16 @@ public int getItemCount() {
return getRoot().getItemCount();
}
-/**
- * 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.
+/**
+ * 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() {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -577,8 +664,22 @@ public int getItemHeight() {
return super.getItemHeight();
}
-/**
- * Answer the root items of the receiver as an Array.
+/**
+ * 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() {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -599,9 +700,17 @@ int getOffScreenItemCount(TreeItem item) {
return expandedItemCount - spaceRemaining;
}
-/**
- * Answer the parent item of the receiver.
- * This is null because the Tree widget does not have a parent item.
+/**
+ * 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() {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -615,10 +724,21 @@ public TreeItem getParentItem() {
TreeRoots getRoot() {
return root;
}
-/**
- * Answer the selected tree items.
- * @return an Array of DrawnTreeItems containing the selected items.
- * An empty Array if no items are selected.
+/**
+ * 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() {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -873,19 +993,16 @@ void mouseDoubleClick(Event event) {
TreeItem hitItem = getRoot().getVisibleItem(hitItemIndex + getTopIndex());
Event newEvent;
- if (hitItem == null) {
+ 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);
- return;
- }
- if (hitItem.getItemCount() == 0) {
- return; // an item was hit but it does not have children
}
- if (itemAction(hitItem, event.x, event.y) == ActionSelect) {
+ else
+ if (hitItem.isLeaf() == false) { // item with children was hit. Default behavior is expand/collapse item
if (hitItem.getExpanded() == true) {
collapse(hitItem, true);
}
@@ -1053,8 +1170,13 @@ boolean redrawParentItem(SelectableItem item) {
return redraw;
}
-/**
- * Remove all items of the receiver.
+/**
+ * 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() {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -1076,13 +1198,23 @@ public void removeAll() {
void removeItem(TreeItem item) {
getRoot().removeItem(item);
}
-/**
-* Removes the listener.
-* <p>
-*
-* @param listener the 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -1093,13 +1225,23 @@ public void removeSelectionListener(SelectionListener listener) {
removeListener (SWT.Selection, listener);
removeListener (SWT.DefaultSelection, listener);
}
-/**
-* Removes the listener.
-* <p>
-*
-* @param listener the 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -1142,7 +1284,7 @@ void removingItem(SelectableItem item) {
newSelectionItem = parentItem;
}
if (newSelectionItem != null) {
- selectNotify(newSelectionItem);
+ selectNotify(newSelectionItem, true);
}
}
super.removingItem(item);
@@ -1283,11 +1425,13 @@ void scrollVertical(int scrollIndexCount) {
0, scrollIndexCount * getItemHeight(), // source x, y
clientArea.width, clientArea.height, true);
}
-/**
- * Select all items of the receiver if it is in multiple
- * selection mode.
- * A SWT.Selection event will not be sent.
- * Do nothing if the receiver is in single selection mode.
+/**
+ * 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() {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -1306,10 +1450,6 @@ public void selectAll() {
void setExpandingItem(TreeItem item) {
expandingItem = item;
}
-/**
- * The font is changing. Reset and recalculate the item
- * height using all items of the receiver.
- */
public void setFont(Font font) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -1339,14 +1479,19 @@ public void setFont(Font font) {
}
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.
- * <p>
- * @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'.
+/**
+ * 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 SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the 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){
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -1354,11 +1499,22 @@ public void setInsertMark(TreeItem item, boolean before){
motif_setInsertMark(item, !before);
}
-/**
- * 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
+/**
+ * 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 Tree#deselectAll()
*/
public void setSelection(TreeItem selectionItems[]) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -1385,13 +1541,22 @@ void setTopIndex(int index, boolean adjustScrollbar) {
super.setTopIndex(index, adjustScrollbar);
calculateWidestScrolledItem(indexDiff);
}
-/**
- * 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.
+/**
+ * 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 listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -1419,10 +1584,21 @@ void showSelectableItem(SelectableItem item) {
}
super.showSelectableItem(item);
}
-/**
- * Return the item at the specified location in the widget.
- * Return null if there is no item at the specified location
- * or if the location is outside the widget client area.
+/**
+ * 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;
@@ -1444,8 +1620,15 @@ public TreeItem getItem(Point point) {
}
return hitItem;
}
-/**
- * Answer the number of selected items in the receiver.
+/**
+ * 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() {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -1453,11 +1636,20 @@ public int getSelectionCount() {
return super.getSelectionCount();
}
-/**
- * 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.
+/**
+ * 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() {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/TreeItem.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/TreeItem.java
index cb0aba6a89..e19494cdd0 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/TreeItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/TreeItem.java
@@ -1,22 +1,31 @@
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.*;
-
-/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
- */
-/**
- * This class represents leaf, non-leaf and root tree items.
- * leaf items don't have any children. non-leaf items have one
- * or more children.
- * Root items don't have a parent item. Root items are either
- * leaf or non-leaf items.
- *
- * This class caches geometrical data for drawing..
+/**
+ * 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 /*final*/ class TreeItem extends AbstractTreeItem {
+/*
+ * This class caches geometric data for drawing.
* A description of the cached data follows:
*
* | 1 || 5 |
@@ -50,9 +59,7 @@ import java.util.*;
* d = SELECTION_PADDING
* e = ITEM_NOIMAGE_OFFSET
* f = ITEM_CONNECTOR_PADDING;
-
*/
-public /*final*/ class TreeItem extends AbstractTreeItem {
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
@@ -173,26 +180,7 @@ static TreeItem checkNull(TreeItem item) {
protected void checkSubclass () {
if (!isValidSubclass ()) error (SWT.ERROR_INVALID_SUBCLASS);
}
-/**
- * Notify the parent that the receiver is being removed.
- * Reset cached data.
- */
-void doDispose() {
- TreeItem parentItem = getParentItem();
-
- if (parentItem != null) {
- parentItem.removeItem(this);
- }
- else {
- getParent().removeItem(this);
- }
- setParentItem(null);
- setImageExtent(null);
- setItemExtent(null);
- setIndex(-1);
- setPaintStartX(-1);
- setTextYPosition(-1);
-}
+
/**
* Draw the hierarchy indicator at 'position'.
*
@@ -419,17 +407,16 @@ Point drawVerticalItemConnector(GC gc, Point position) {
return position;
}
-/**
- * Gets the widget bounds.
- * The widget bounds is the rectangle around the item text. It is
- * the same as the selection rectangle.
- * <p>
- * @return a rectangle that is the widget bounds.
- *
- * @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>
+/**
+ * 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);
@@ -520,8 +507,16 @@ int getItemConnectorWidth() {
}
return itemConnectorWidth;
}
-/**
- * Return the number of children.
+/**
+ * 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() {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -565,8 +560,21 @@ int getItemStartX() {
}
return itemStartX;
}
-/**
- * Answer the child items of the receiver as an Array.
+/**
+ * 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() {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -613,8 +621,15 @@ int getPaintStartX() {
int getPaintStopX() {
return (getItemStartX() + getItemExtent().x - getParent().getHorizontalOffset());
}
-/**
- * Answer the parent widget of the receiver.
+/**
+ * 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() {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -622,9 +637,17 @@ public Tree getParent() {
return (Tree) super.getSelectableParent();
}
-/**
- * Answer the parent item of the receiver or null if the
- * receiver is a root.
+/**
+ * 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() {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -947,14 +970,16 @@ void reset() {
setPaintStartX(-1);
setTextYPosition(-1);
}
-/**
- * Set whether the receiver is expanded or not.
- * If the receiver is expanded its child items are visible.
- * @param expand -
- * true=the receiver will be expanded, making its child items
- * visible.
- * false=the receiver will be collapsed, making its child items
- * invisible
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -967,10 +992,6 @@ public void setExpanded(boolean expand) {
getParent().collapse(this, false);
}
}
-/**
- * Set the image of the receiver to 'newImage'.
- * Reset cached data and notify the parent if the image has changed.
- */
public void setImage(Image newImage) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
@@ -1035,13 +1056,10 @@ void setPaintStartX(int startX) {
void setParentItem(TreeItem parentItem) {
this.parentItem = parentItem;
}
-/**
- * Set the label text of the receiver to 'string'.
- * Reset cached data and notify the parent if the text has
- * changed.
- * 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.
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -1069,24 +1087,50 @@ public void setText(String newText) {
void setTextYPosition(int yPosition) {
textYPosition = yPosition;
}
-/**
- * Destroy all children of the receiver
- * Collapsing the item speeds up deleting the children.
- */
-void disposeItem() {
- Tree parent = getParent();
-
+
+public void dispose() {
+ if (!isValidWidget ()) 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.disposeItem();
+
+ super.dispose();
}
-/**
- * Return whether or not the receiver is checked.
- * Always return false if the parent of the receiver does not
- * have the CHECK style.
+
+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() {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -1094,21 +1138,21 @@ public boolean getChecked() {
return super.getChecked();
}
-/**
- * Answer the display of the receiver's parent widget.
- */
public Display getDisplay() {
return super.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>
+/**
+ * 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() {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -1116,9 +1160,16 @@ public boolean getGrayed() {
return super.getGrayed();
}
-/**
- * Set the checked state to 'checked' if the parent of the
- * receiver has the CHECK style.
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
@@ -1126,15 +1177,16 @@ public void setChecked(boolean checked) {
super.setChecked(checked);
}
-/**
- * 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>
+/**
+ * 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) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/TreeRoots.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/TreeRoots.java
index c9e4dea7ab..dec4c31435 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/TreeRoots.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/TreeRoots.java
@@ -1,13 +1,13 @@
package org.eclipse.swt.widgets;
-import org.eclipse.swt.graphics.*;
-import java.util.*;
-
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
+import org.eclipse.swt.graphics.*;
+import java.util.*;
+
/**
* This class is used to store tree root items.
* Instances of this class are never displayed.
@@ -41,16 +41,15 @@ void calculateVisibleItemCount() {
* of this item.
*/
void calculateVisibleItemCountParent() {}
-/**
- * Destroy all children of the receiver
- */
-void disposeItem() {
+
+public void dispose() {
+ if (!isValidWidget ()) 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.disposeItem();
+ super.dispose();
parent.setRemovingAll(false);
}
/**
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
index 7f80b5e68d..1ca65f7b66 100755
--- 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
@@ -1,10 +1,11 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (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.*;
@@ -14,12 +15,16 @@ import java.util.EventListener;
public abstract class Widget {
public int handle;
- int style;
+ 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;
@@ -99,6 +104,48 @@ 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 ();
@@ -110,6 +157,10 @@ void deregister () {
WidgetTable.remove (handle);
}
+void destroyToolTip (int toolTipHandle) {
+ if (toolTipHandle != 0) OS.PtDestroyWidget (toolTipHandle);
+}
+
void destroyWidget () {
int topHandle = topHandle ();
releaseHandle ();
@@ -119,8 +170,12 @@ void destroyWidget () {
}
public void dispose () {
+ /*
+ * 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);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
releaseChild ();
releaseWidget ();
destroyWidget ();
@@ -176,7 +231,9 @@ void hookEvents () {
}
public boolean isDisposed () {
- return handle == 0;
+ if (handle != 0) return false;
+ if ((state & HANDLE) != 0) return true;
+ return (state & DISPOSED) != 0;
}
boolean isValidSubclass () {
@@ -194,7 +251,9 @@ boolean isValidThread () {
}
boolean isValidWidget () {
- return true /*handle != 0*/;
+ if (handle != 0) return true;
+ if ((state & HANDLE) != 0) return false;
+ return (state & DISPOSED) == 0;
}
public void notifyListeners (int eventType, Event event) {
@@ -222,6 +281,14 @@ void postEvent (int eventType, Event event) {
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;
}
@@ -238,13 +305,18 @@ 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 data, int info) {
+int processEvent (int widget, int data, int info) {
switch (data) {
-// case SWT.Arm: return processArm (info);
+ 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);
@@ -265,7 +337,6 @@ int processEvent (int data, int info) {
case SWT.Show: return processShow (info);
case SWT.Selection: return processSelection (info);
case SWT.Verify: return processVerify (info);
- case -1: return processShellResize (info);
}
return OS.Pt_CONTINUE;
}
@@ -298,10 +369,6 @@ int processShow (int info) {
return OS.Pt_CONTINUE;
}
-int processShellResize (int info) {
- return OS.Pt_CONTINUE;
-}
-
int processSelection (int info) {
return OS.Pt_CONTINUE;
}
@@ -321,14 +388,16 @@ void register () {
void releaseHandle () {
handle = 0;
-// state |= DISPOSED;
+ state |= DISPOSED;
}
void releaseWidget () {
sendEvent (SWT.Dispose);
-// state |= DISPOSED;
+ deregister ();
eventTable = null;
data = null;
+ keys = null;
+ values = null;
}
public void removeListener (int eventType, Listener handler) {
@@ -355,6 +424,27 @@ public void removeDisposeListener (DisposeListener listener) {
eventTable.unhook (SWT.Dispose, listener);
}
+void replaceMnemonic (int mnemonic, int mods) {
+ 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]);
+ OS.PtRemoveHotkeyHandler (handle, key, 0, (short)0, SWT.Activate, display.windowProc);
+ }
+ }
+ }
+ if (mnemonic == 0) return;
+ char key = Character.toLowerCase ((char)mnemonic);
+ OS.PtAddHotkeyHandler (handle, key, mods, (short)0, SWT.Activate, display.windowProc);
+}
+
void sendEvent (int eventType) {
if (eventTable == null) return;
sendEvent (eventType, new Event ());
@@ -438,4 +528,4 @@ int topHandle () {
return handle;
}
-} \ No newline at end of file
+}
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
index 570e5b3c78..d657be6abf 100755
--- 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
@@ -2,8 +2,8 @@ package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.photon.*;
@@ -62,7 +62,7 @@ public static synchronized Widget remove (int handle) {
if (GetArgs [1] == 0) return null;
OS.memmove (ArgBuffer, GetArgs [1], 4);
if (ArgBuffer [0] == 0) return null;
- int index = ArgBuffer [1] - 1;
+ int index = ArgBuffer [0] - 1;
Widget widget = null;
if (0 <= index && index < WidgetTable.length) {
widget = WidgetTable [index];
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/library/build.bat b/bundles/org.eclipse.swt/Eclipse SWT/win32/library/build.bat
index 1432829290..eec5fa5854 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/library/build.bat
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/library/build.bat
@@ -1,5 +1,8 @@
@echo off
+rem (c) Copyright IBM Corp., 2000, 2001
+rem All Rights Reserved.
+
IF NOT "%JAVA_HOME%"=="" GOTO MAKE
rem *****
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/library/library.c b/bundles/org.eclipse.swt/Eclipse SWT/win32/library/library.c
index 3bcd6f49df..8fd9a633d0 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/library/library.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/library/library.c
@@ -1,3 +1,8 @@
+/*
+ * (c) Copyright IBM Corp., 2000, 2001
+ * All Rights Reserved.
+ */
+
/**
* library.c
*
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/library/makefile.mak b/bundles/org.eclipse.swt/Eclipse SWT/win32/library/makefile.mak
index 80237ef4bc..e6d66f61a4 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/library/makefile.mak
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/library/makefile.mak
@@ -1,5 +1,7 @@
# Makefile for module 'swt'
-# (C) Copyright 1999 OTI Object Technology International Inc.
+
+# (c) Copyright IBM Corp., 2000, 2001
+# All Rights Reserved.
#
# Autogenerated Code
@@ -11,7 +13,7 @@ APPVER=5.0
!include <win32.mak>
maj_ver=0
-min_ver=105
+min_ver=125
bld_num=0
pgm_ver_str="SWT $(maj_ver).0$(min_ver) for Windows"
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/library/structs.c b/bundles/org.eclipse.swt/Eclipse SWT/win32/library/structs.c
index 3db163c809..63ec0a111c 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/library/structs.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/library/structs.c
@@ -1,3 +1,8 @@
+/*
+ * (c) Copyright IBM Corp., 2000, 2001
+ * All Rights Reserved.
+ */
+
/**
* JNI SWT object field getters and setters declarations for Windows structs
*/
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/library/structs.h b/bundles/org.eclipse.swt/Eclipse SWT/win32/library/structs.h
index 11e62e8154..6ae3474aa0 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/library/structs.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/library/structs.h
@@ -1,3 +1,8 @@
+/*
+ * (c) Copyright IBM Corp., 2000, 2001
+ * All Rights Reserved.
+ */
+
/**
* JNI SWT object field getters and setters declarations for Windows structs.
*/
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/library/swt.c b/bundles/org.eclipse.swt/Eclipse SWT/win32/library/swt.c
index 1eb55ee847..eb9bc7eb58 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/library/swt.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/library/swt.c
@@ -1,3 +1,8 @@
+/*
+ * (c) Copyright IBM Corp., 2000, 2001
+ * All Rights Reserved.
+ */
+
/**
* SWT OS natives implementation.
*/
@@ -7890,4 +7895,72 @@ JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_SetStretchBltMode
#endif
return (jint) SetStretchBltMode((HDC)hdc, iStretchMode);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_win32_OS
+ * Method: SetWindowsHookEx
+ * Signature: (IIII)I
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_SetWindowsHookEx
+ (JNIEnv *env, jclass that, jint idHook, jint lpfn, jint hMod, jint dwThreadId)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "SetWindowsHookEx\n");
+#endif
+ return (jint) SetWindowsHookEx(idHook, (HOOKPROC)lpfn, (HINSTANCE)hMod, dwThreadId);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_win32_OS
+ * Method: UnhookWindowsHookEx
+ * Signature: (I)I
+ */
+JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_win32_OS_UnhookWindowsHookEx
+ (JNIEnv *env, jclass that, jint hhk)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "UnhookWindowsHookEx\n");
+#endif
+
+ return (jboolean) UnhookWindowsHookEx((HHOOK)hhk);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_win32_OS
+ * Method: CallNextHookEx
+ * Signature: (IIII)I
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_CallNextHookEx
+ (JNIEnv *env, jclass that, jint hhk, jint nCode, jint wParam, jint lParam)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "CallNextHookEx\n");
+#endif
+
+ return (jint) CallNextHookEx((HHOOK)hhk, nCode, (WPARAM)wParam, (LPARAM)lParam);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_win32_OS
+ * Method: MoveMemory
+ * Signature: (Lorg/eclipse/swt/internal/win32/MSG;II)V
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_win32_OS_MoveMemory__Lorg_eclipse_swt_internal_win32_MSG_2II
+ (JNIEnv *env, jclass that, jobject Destination, jint Source, jint Length)
+{
+ DECL_GLOB(pGlob)
+ MSG msg, *lpDestination1=NULL;
+
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "MoveMemory__Lorg_eclipse_swt_internal_win32_MSG_2II\n");
+#endif
+
+ MoveMemory((PVOID)&msg, (CONST VOID *)Source, Length);
+
+ if (Destination) {
+ lpDestination1 = &msg;
+ cacheMsgFids(env, Destination, &PGLOB(MsgFc));
+ setMsgFields(env, Destination, lpDestination1, &PGLOB(MsgFc));
+ }
} \ No newline at end of file
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/library/swt.rc b/bundles/org.eclipse.swt/Eclipse SWT/win32/library/swt.rc
index 506d7f0d8f..b875e93746 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/library/swt.rc
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/library/swt.rc
@@ -1,3 +1,8 @@
+/*
+ * (c) Copyright IBM Corp., 2000, 2001
+ * All Rights Reserved.
+ */
+
//Microsoft Developer Studio generated resource script.
//
@@ -29,7 +34,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
//
VS_VERSION_INFO VERSIONINFO
- FILEVERSION 0,1,0,5
+ FILEVERSION 0,1,2,5
PRODUCTVERSION 0,0,0,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
@@ -47,10 +52,10 @@ BEGIN
BEGIN
VALUE "CompanyName", "IBM Corporation\0"
VALUE "FileDescription", "Standard Widget Toolkit\0"
- VALUE "FileVersion", "win32 0.105\0"
+ VALUE "FileVersion", "win32 0.125\0"
VALUE "InternalName", "SWT\0"
- VALUE "LegalCopyright", "Copyright © 1999-2000\0"
- VALUE "OriginalFilename", "swt0105.dll\0"
+ VALUE "LegalCopyright", "© Copyright IBM Corp. 2000, 2001. All Rights Reserved.\0"
+ VALUE "OriginalFilename", "swt0125.dll\0"
VALUE "ProductName", "\0"
VALUE "ProductVersion", "0, 0, 0, 0\0"
END
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/library/swtole.c b/bundles/org.eclipse.swt/Eclipse SWT/win32/library/swtole.c
index 2fc92cf686..0c94b763cf 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/library/swtole.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/library/swtole.c
@@ -1,3 +1,8 @@
+/*
+ * (c) Copyright IBM Corp., 2000, 2001
+ * All Rights Reserved.
+ */
+
#include "globals.h"
#include "structs.h"
@@ -2239,6 +2244,38 @@ JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_VtblCall__III
}
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
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
index ff1b0e13d4..6bbc3871d8 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.graphics;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.win32.*;
@@ -147,8 +147,13 @@ public boolean equals (Object object) {
* 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;
}
@@ -156,8 +161,13 @@ public int getBlue () {
* 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 ;
}
@@ -165,15 +175,25 @@ public int getGreen () {
* 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);
}
@@ -274,6 +294,7 @@ public boolean isDisposed() {
* @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/win32/org/eclipse/swt/graphics/Cursor.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Cursor.java
index 6c085722e8..2e81321944 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.graphics;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.win32.*;
@@ -318,6 +318,17 @@ 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>
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
index d953280dea..a6c06ba8bf 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.graphics;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.*;
@@ -21,6 +21,9 @@ public abstract class Device implements Drawable {
/* Palette */
public int hPalette = 0;
int [] colorRefCount;
+
+ /* System Font */
+ int systemFont;
/* Font Enumeration */
int nFonts = 256;
@@ -28,6 +31,36 @@ public abstract class Device implements Drawable {
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>
@@ -41,33 +74,19 @@ public abstract class Device implements Drawable {
* @see DeviceData
*/
public Device(DeviceData data) {
- create (data);
- init ();
if (data != null) {
debug = data.debug;
tracking = data.tracking;
}
+ create (data);
+ init ();
if (tracking) {
errors = new Error [128];
objects = new Object [128];
}
-}
-
-/*
- * Temporary code.
- */
-static Device getDevice () {
- Device device = null;
- try {
- Class clazz = Class.forName ("org.eclipse.swt.widgets.Display");
- java.lang.reflect.Method method = clazz.getMethod("getCurrent", new Class[0]);
- device = (Device) method.invoke(clazz, new Object[0]);
- if (device == null) {
- method = clazz.getMethod("getDefault", new Class[0]);
- device = (Device)method.invoke(clazz, new Object[0]);
- }
- } catch (Throwable e) {};
- return device;
+
+ /* Initialize the system font slot */
+ systemFont = getSystemFont().handle;
}
/**
@@ -279,7 +298,6 @@ public DeviceData getDeviceData () {
* </ul>
*
* @see #getBounds
- * @see #computeTrim
*/
public Rectangle getClientArea () {
return getBounds ();
@@ -681,4 +699,4 @@ public void setWarnings (boolean warnings) {
checkDevice ();
}
-} \ No newline at end of file
+}
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
index f971a60537..27fe10271d 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.graphics;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class DeviceData {
@@ -14,4 +14,4 @@ public class DeviceData {
public boolean tracking;
public Error [] errors;
public Object [] objects;
-} \ No newline at end of file
+}
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
index 01e83c286a..df4ea579e2 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.graphics;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.win32.*;
@@ -131,8 +131,13 @@ public boolean equals(Object object) {
* 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))};
@@ -177,6 +182,17 @@ 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>
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
index c860b80ce6..9b05c77236 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.graphics;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.*;
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
index 1769329a56..5abff78bff 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.graphics;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.win32.*;
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
index c207ecd998..21b370b52d 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.graphics;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.*;
@@ -21,7 +21,7 @@ import org.eclipse.swt.*;
* number of device contexts available.
* </p>
*
- * @see PaintEvent
+ * @see org.eclipse.swt.events.PaintEvent
*/
public final class GC {
@@ -84,12 +84,16 @@ public GC(Drawable drawable) {
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the image is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the image is not a bitmap</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) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+ if (image.type != SWT.BITMAP || image.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
/* Get the HDC for the device */
Device device = data.device;
@@ -117,8 +121,13 @@ public void copyArea(Image image, int x, int y) {
* @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);
int hwnd = OS.WindowFromDC(handle);
if (hwnd == 0) {
OS.BitBlt(handle, destX, destY, width, height, handle, srcX, srcY, OS.SRCCOPY);
@@ -256,8 +265,12 @@ public void dispose() {
* @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);
int x1, y1, x2, y2,tmp;
boolean isNegative;
double pi = 3.1415926535;
@@ -310,9 +323,14 @@ public void drawArc (int x, int y, int width, int height, int startAngle, int en
* @param width the width of the rectangle
* @param height the height of the rectangle
*
- * @see drawRectangle
+ * @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);
@@ -328,13 +346,19 @@ public void drawFocus (int x, int y, int width, int height) {
*
* @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);
}
@@ -358,18 +382,24 @@ public void drawImage(Image image, int x, int y) {
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the image is null</li>
- * <li>ERROR_INVALID_IMAGE - if the given coordinates are outside the bounds of their respective images</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 <uo>
* <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);
}
@@ -721,8 +751,13 @@ void drawBitmap(Image srcImage, int srcX, int srcY, int srcWidth, int srcHeight,
* @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.MoveToEx (handle, x1, y1, 0);
OS.LineTo (handle, x2, y2);
OS.SetPixel (handle, x2, y2, OS.GetTextColor (handle));
@@ -744,8 +779,13 @@ public void drawLine (int x1, int y1, int x2, int y2) {
* @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);
@@ -767,8 +807,12 @@ public void drawOval (int x, int y, int width, int height) {
* @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);
@@ -789,8 +833,12 @@ public void drawPolygon(int[] pointArray) {
* @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);
}
@@ -805,8 +853,13 @@ public void drawPolyline(int[] pointArray) {
* @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);
@@ -824,6 +877,9 @@ public void drawRectangle (int x, int y, int width, int height) {
* @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);
@@ -844,8 +900,13 @@ public void drawRectangle (Rectangle rect) {
* @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);
int nullBrush = OS.GetStockObject(OS.NULL_BRUSH);
int oldBrush = OS.SelectObject(handle, nullBrush);
OS.RoundRect(handle, x,y,x+width,y+height, arcWidth, arcHeight);
@@ -866,8 +927,12 @@ public void drawRoundRectangle (int x, int y, int width, int height, int arcWidt
* @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);
byte [] buffer = Converter.wcsToMbcs (0, string, false);
OS.TextOut (handle, x, y, buffer, buffer.length);
}
@@ -888,8 +953,12 @@ public void drawString (String string, int x, int y) {
* @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);
byte [] buffer = Converter.wcsToMbcs (0, string, false);
if (isTransparent) {
int oldBkMode = OS.SetBkMode(handle, OS.TRANSPARENT);
@@ -914,8 +983,12 @@ public void drawString (String string, int x, int y, boolean isTransparent) {
* @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) {
+ if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
RECT rect = new RECT();
OS.SetRect(rect, x, y, 0x7FFF, 0x7FFF);
byte [] buffer = Converter.wcsToMbcs(0, string, false);
@@ -938,8 +1011,12 @@ public void drawText (String string, int x, int y) {
* @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);
RECT rect = new RECT();
OS.SetRect(rect, x, y, 0x7FFF, 0x7FFF);
byte [] buffer = Converter.wcsToMbcs(0, string, false);
@@ -995,10 +1072,14 @@ public boolean equals (Object object) {
* @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);
int x1, y1, x2, y2,tmp;
boolean isNegative;
double pi = 3.1415926535;
@@ -1055,15 +1136,18 @@ public void fillArc (int x, int y, int width, int height, int startAngle, int en
* @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.
-
+ /* 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,y+height);
OS.SelectObject(handle,oldPen);
}
@@ -1081,10 +1165,14 @@ public void fillOval (int x, int y, int width, int height) {
* @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);
@@ -1100,9 +1188,14 @@ public void fillPolygon(int[] pointArray) {
* @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 (OS.GetROP2(handle) == OS.R2_COPYPEN)
OS.PatBlt (handle, x, y, width, height, OS.PATCOPY);
else
@@ -1118,6 +1211,9 @@ public void fillRectangle (int x, int y, int width, int height) {
* @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
*/
@@ -1137,9 +1233,14 @@ public void fillRectangle (Rectangle rect) {
* @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);
@@ -1156,8 +1257,13 @@ public void fillRoundRectangle (int x, int y, int width, int height, int arcWidt
*
* @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);
byte[] buffer = Converter.wcsToMbcs(0, new char[] { ch });
int val = 0;
for (int i = 0; i < buffer.length; i++) {
@@ -1172,8 +1278,13 @@ public int getAdvanceWidth(char 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);
int color = OS.GetBkColor(handle);
if (color == OS.CLR_INVALID) {
color = OS.GetSysColor(OS.COLOR_WINDOW);
@@ -1192,8 +1303,13 @@ public Color getBackground() {
*
* @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);
byte[] buffer = Converter.wcsToMbcs(0, new char[] { ch });
int val = 0;
for (int i = 0; i < buffer.length; i++) {
@@ -1219,8 +1335,13 @@ public int getCharWidth(char ch) {
* 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);
@@ -1235,8 +1356,12 @@ public Rectangle getClipping() {
* @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;
@@ -1250,8 +1375,13 @@ public void getClipping (Region region) {
* 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);
}
@@ -1262,8 +1392,13 @@ public Font getFont () {
* 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);
@@ -1273,8 +1408,13 @@ public FontMetrics getFontMetrics() {
* 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);
@@ -1289,8 +1429,13 @@ public Color getForeground() {
* <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);
@@ -1311,8 +1456,13 @@ public int getLineStyle() {
* <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);
@@ -1328,8 +1478,13 @@ public int getLineWidth() {
* 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 OS.GetROP2(handle) == OS.R2_XORPEN;
}
@@ -1371,6 +1526,10 @@ void init(Drawable drawable, GCData data, int hDC) {
*
* @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 () {
@@ -1386,8 +1545,13 @@ public int hashCode () {
* 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);
@@ -1417,10 +1581,16 @@ public boolean isDisposed() {
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the color is null</li>
- * </ul>
+ * <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);
@@ -1438,8 +1608,12 @@ public void setBackground (Color color) {
* @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);
@@ -1452,11 +1626,12 @@ public void setClipping (int x, int y, int width, int height) {
*
* @param rect the clipping rectangle
*
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the rectangle is null</li>
+ * @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;
@@ -1470,8 +1645,13 @@ public void setClipping (Rectangle rect) {
* 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);
@@ -1484,14 +1664,21 @@ public void setClipping (Region region) {
* 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) {
- int hFont = OS.GetStockObject(OS.DEFAULT_GUI_FONT);
- if (hFont == 0) hFont = OS.GetStockObject(OS.SYSTEM_FONT);
- OS.SelectObject(handle, hFont);
- } else {
+ OS.SelectObject(handle, data.device.systemFont);
+ } else {
+ if (font.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
OS.SelectObject(handle, font.handle);
}
}
@@ -1501,9 +1688,19 @@ public void setFont (Font font) {
* 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();
@@ -1521,8 +1718,13 @@ public void setForeground (Color color) {
* <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;
@@ -1549,8 +1751,13 @@ public void setLineStyle(int lineStyle) {
* <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);
@@ -1569,8 +1776,13 @@ public void setLineWidth(int lineWidth) {
* 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 {
@@ -1589,8 +1801,16 @@ public void setXORMode(boolean xor) {
*
* @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();
if (string.length () == 0) {
@@ -1614,8 +1834,16 @@ public Point stringExtent(String string) {
*
* @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);
if (string.length () == 0) {
SIZE size = new SIZE();
@@ -1629,6 +1857,17 @@ public Point textExtent(String 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 + "}";
+}
+
/**
* Invokes platform specific functionality to allocate a new graphics context.
* <p>
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
index ff0794deb1..ab351571eb 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.graphics;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.win32.*;
@@ -28,4 +28,4 @@ public final class GCData {
public int hFont;
public int hNullBitmap;
public PAINTSTRUCT ps;
-} \ No newline at end of file
+}
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
index 73c9303fc5..a321b0c87c 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.graphics;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.win32.*;
@@ -159,6 +159,7 @@ public Image(Device device, int width, int height) {
* @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
@@ -173,6 +174,7 @@ public Image(Device device, Image srcImage, int flag) {
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();
@@ -760,8 +762,13 @@ public boolean equals (Object object) {
* <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 */
@@ -816,10 +823,12 @@ public Color getBackground() {
* @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();
@@ -850,12 +859,14 @@ public Rectangle getBounds() {
* @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) {
@@ -1486,7 +1497,7 @@ public int internal_new_GC (GCData data) {
/* Set the GCData fields */
data.device = device;
data.image = this;
- data.hFont = device.getSystemFont().handle;
+ data.hFont = device.systemFont;
}
return imageDC;
}
@@ -1545,10 +1556,16 @@ public boolean isDisposed() {
*
* @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;
/* Get the HDC for the device */
@@ -1572,6 +1589,18 @@ public void setBackground(Color color) {
/* 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>
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
index 4e5480999b..383a97d726 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.graphics;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.win32.*;
@@ -10,7 +10,7 @@ import org.eclipse.swt.*;
/**
* Instances of this class represent areas of an x-y coordinate
- * system that are agregates of the areas covered by a number
+ * system that are aggregates of the areas covered by a number
* of rectangles.
* <p>
* Application code must explicitly invoke the <code>Region.dispose()</code>
@@ -53,8 +53,12 @@ Region(int handle) {
* @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 void add (Rectangle rect) {
+ if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
if (rect == null) SWT.error(SWT.ERROR_NULL_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);
@@ -71,8 +75,12 @@ public void add (Rectangle rect) {
* @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 void add (Region region) {
+ if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
if (region == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
OS.CombineRgn (handle, handle, region.handle, OS.RGN_OR);
}
@@ -85,8 +93,13 @@ public void add (Region region) {
* @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);
}
@@ -101,6 +114,9 @@ public boolean contains (int x, int y) {
* @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);
@@ -143,9 +159,14 @@ public boolean equals (Object object) {
*
* @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);
@@ -176,9 +197,14 @@ public int hashCode () {
* @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);
@@ -195,6 +221,9 @@ public boolean intersects (int x, int y, int width, int height) {
* @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
*/
@@ -225,6 +254,7 @@ public boolean isDisposed() {
* @return <code>true</code> if the receiver is empty, and <code>false</code> otherwise
*/
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;
@@ -249,4 +279,15 @@ 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/Converter.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/Converter.java
index 6079208d46..e0f7c442a3 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.internal;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.win32.*;
@@ -76,6 +76,7 @@ public static char [] mbcsToWcs (int codePage, byte [] buffer) {
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;
@@ -123,7 +124,7 @@ public static byte [] wcsToMbcs (int codePage, char [] buffer, boolean terminate
*/
byte [] mbcs = new byte [(terminate) ? length + 1 : length];
for (int i=0; i<length; i++) {
- if ((buffer [i] & 0xFF) <= 0x7F) {
+ if ((buffer [i] & 0xFFFF) <= 0x7F) {
mbcs [i] = (byte) buffer [i];
} else {
/* Convert from UNICODE to DBCS */
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/ACCEL.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/ACCEL.java
index a1635211f0..bb2358c182 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/ACCEL.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/ACCEL.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class ACCEL {
public byte fVirt;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/BITMAP.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/BITMAP.java
index 56bb1f7609..bd7fddbae7 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/BITMAP.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/BITMAP.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class BITMAP {
public int bmType;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/BROWSEINFO.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/BROWSEINFO.java
index 70dfd29124..62bff55770 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/BROWSEINFO.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/BROWSEINFO.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class BROWSEINFO {
public int hwndOwner;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/CHOOSECOLOR.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/CHOOSECOLOR.java
index 53942a1ab8..3e55e87f0a 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/CHOOSECOLOR.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/CHOOSECOLOR.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class CHOOSECOLOR {
public int lStructSize;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/CHOOSEFONT.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/CHOOSEFONT.java
index e109598954..af3496e9ce 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/CHOOSEFONT.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/CHOOSEFONT.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class CHOOSEFONT {
public int lStructSize;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/COMPOSITIONFORM.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/COMPOSITIONFORM.java
index 5e9e840ae2..47c61ba3d7 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/COMPOSITIONFORM.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/COMPOSITIONFORM.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class COMPOSITIONFORM {
public int dwStyle;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/CREATESTRUCT.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/CREATESTRUCT.java
index ab2f691500..20ce99ee28 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/CREATESTRUCT.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/CREATESTRUCT.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class CREATESTRUCT {
public int lpCreateParams;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/DIBSECTION.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/DIBSECTION.java
index 765c55bc06..a4f81b07e4 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/DIBSECTION.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/DIBSECTION.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class DIBSECTION extends BITMAP {
public int biSize;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/DLLVERSIONINFO.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/DLLVERSIONINFO.java
index e29656f767..cf7feb6443 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/DLLVERSIONINFO.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/DLLVERSIONINFO.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class DLLVERSIONINFO {
public int cbSize;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/DOCINFO.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/DOCINFO.java
index 3e3ebffa98..2bf47fc62c 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/DOCINFO.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/DOCINFO.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class DOCINFO {
public int cbSize;
@@ -12,4 +11,4 @@ public class DOCINFO {
public int lpszDatatype;// LPCTSTR
public int fwType; // DWORD
public static final int sizeof = 20;
-} \ No newline at end of file
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/DRAWITEMSTRUCT.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/DRAWITEMSTRUCT.java
index 127cfcfc1f..f521b51c65 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/DRAWITEMSTRUCT.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/DRAWITEMSTRUCT.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class DRAWITEMSTRUCT {
public int CtlType;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/HDITEM.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/HDITEM.java
index 0db94be9cc..9f77689c42 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/HDITEM.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/HDITEM.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class HDITEM {
public int mask;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/HELPINFO.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/HELPINFO.java
index 29e6ea3b8c..b26f03b462 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/HELPINFO.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/HELPINFO.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class HELPINFO {
public int cbSize;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/ICONINFO.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/ICONINFO.java
index 1a2aa1c096..705afc412e 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/ICONINFO.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/ICONINFO.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class ICONINFO {
public boolean fIcon;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/INITCOMMONCONTROLSEX.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/INITCOMMONCONTROLSEX.java
index 0a3b430608..353bf4845b 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/INITCOMMONCONTROLSEX.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/INITCOMMONCONTROLSEX.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class INITCOMMONCONTROLSEX {
public int dwSize;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/LOGBRUSH.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/LOGBRUSH.java
index 8e5a2f57f8..2ed2297c01 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/LOGBRUSH.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/LOGBRUSH.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class LOGBRUSH {
public int lbStyle;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/LOGFONT.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/LOGFONT.java
index b93622ba3b..535b41a392 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/LOGFONT.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/LOGFONT.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class LOGFONT {
public int lfHeight;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/LOGPEN.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/LOGPEN.java
index dd603d3fbb..022df9c14d 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/LOGPEN.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/LOGPEN.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class LOGPEN {
public int lopnStyle;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/LRESULT.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/LRESULT.java
index ef10f2502c..f475dee40c 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/LRESULT.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/LRESULT.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class LRESULT {
public int value;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/LVCOLUMN.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/LVCOLUMN.java
index 1b24d98729..fc3d5bc9e3 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/LVCOLUMN.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/LVCOLUMN.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class LVCOLUMN {
public int mask;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/LVHITTESTINFO.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/LVHITTESTINFO.java
index 308d8570a9..c01a08011e 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/LVHITTESTINFO.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/LVHITTESTINFO.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class LVHITTESTINFO {
// POINT pt;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/LVITEM.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/LVITEM.java
index 148f75af15..f7b4277364 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/LVITEM.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/LVITEM.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class LVITEM {
public int mask;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/MEASUREITEMSTRUCT.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/MEASUREITEMSTRUCT.java
index af35f68a5e..b4a7ea9572 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/MEASUREITEMSTRUCT.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/MEASUREITEMSTRUCT.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class MEASUREITEMSTRUCT {
public int CtlType;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/MENUINFO.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/MENUINFO.java
index c37823cac9..c28ee6f543 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/MENUINFO.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/MENUINFO.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class MENUINFO {
public int cbSize;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/MENUITEMINFO.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/MENUITEMINFO.java
index 86e7f9aa47..3aa964d812 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/MENUITEMINFO.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/MENUITEMINFO.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class MENUITEMINFO {
public int cbSize;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/MSG.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/MSG.java
index 5a6d263bbe..e4e1f3db43 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/MSG.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/MSG.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class MSG {
public int hwnd;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/NMHDR.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/NMHDR.java
index 0e75279985..2302fdea6d 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/NMHDR.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/NMHDR.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class NMHDR {
public int hwndFrom;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/NMHEADER.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/NMHEADER.java
index ffc6575b13..944a76ecd7 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/NMHEADER.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/NMHEADER.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class NMHEADER extends NMHDR {
public int iItem;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/NMLISTVIEW.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/NMLISTVIEW.java
index b994609ff5..52d2cda846 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/NMLISTVIEW.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/NMLISTVIEW.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class NMLISTVIEW extends NMHDR {
public int iItem;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/NMTOOLBAR.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/NMTOOLBAR.java
index b609a1a251..7d46f3d0be 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/NMTOOLBAR.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/NMTOOLBAR.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class NMTOOLBAR extends NMHDR {
public int iItem;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/NMTTDISPINFO.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/NMTTDISPINFO.java
index 46326a0a88..07f398de40 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/NMTTDISPINFO.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/NMTTDISPINFO.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class NMTTDISPINFO extends NMHDR {
public int lpszText;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/OPENFILENAME.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/OPENFILENAME.java
index 40dbee0308..74fbcad8b0 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/OPENFILENAME.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/OPENFILENAME.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class OPENFILENAME {
public int lStructSize;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/OS.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/OS.java
index dab3063332..a48ecacad1 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/OS.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/OS.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.*;
@@ -69,6 +68,25 @@ public class OS {
// public static final byte WBF_CLASS = 0x0F;
// public static final byte WBF_ISWHITE = 0x10;
+/*** BEGIN SetWindowsHook ***/
+// public static final int WH_MSGFILTER = -1;
+// public static final int WH_JOURNALRECORD = 0;
+// public static final int WH_JOURNALPLAYBACK = 1;
+// public static final int WH_KEYBOARD = 2;
+ public static final int WH_GETMESSAGE = 3;
+// public static final int WH_CALLWNDPROC = 4;
+// public static final int WH_CBT = 5;
+// public static final int WH_SYSMSGFILTER = 6;
+// public static final int WH_MOUSE = 7;
+// public static final int WH_HARDWARE = 8;
+// public static final int WH_DEBUG = 9;
+// public static final int WH_SHELL = 10;
+// public static final int WH_FOREGROUNDIDLE = 11;
+// public static final int WH_CALLWNDPROCRET = 12;
+// public static final int WH_KEYBOARD_LL = 13;
+// public static final int WH_MOUSE_LL = 14;
+/*** END SetWindowsHook ***/
+
/*** BEGIN SHGetFileInfo ***/
// public static final int FILE_ATTRIBUTE_READONLY = 0x00000001;
// public static final int FILE_ATTRIBUTE_HIDDEN = 0x00000002;
@@ -3010,7 +3028,7 @@ public class OS {
// public static final int TB_SETINDENT = (WM_USER + 47);
// public static final int TB_SETMAXTEXTROWS = (WM_USER + 60);
// public static final int TB_SETPARENT = 0x425;
-// public static final int TB_SETROWS = 0x427;
+ public static final int TB_SETROWS = 0x427;
public static final int TB_SETSTATE = 0x411;
// public static final int TB_SETSTYLE = (WM_USER + 56);
// public static final int TB_SETTOOLTIPS = 0x424;
@@ -3500,7 +3518,7 @@ public class OS {
// public static final int WM_ACTIVATEAPP = 0x1C;
// public static final int WM_AFXFIRST = 0x360;
// public static final int WM_AFXLAST = 0x37F;
-// public static final int WM_APP = 0x8000;
+ public static final int WM_APP = 0x8000;
// public static final int WM_ASKCBFORMATNAME = 0x30C;
// public static final int WM_CANCELJOURNAL = 0x4B;
public static final int WM_CANCELMODE = 0x1F;
@@ -3847,6 +3865,7 @@ 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 CallWindowProc (int lpPrevWndFunc, int hWnd, int Msg, int wParam, int lParam);
public static final native short CharLower (short ch);
public static final native short CharUpper (short ch);
@@ -4251,28 +4270,33 @@ public static final native void MoveMemory (
);
public static final native void MoveMemory (
NMLISTVIEW Destination, // address of move destination
- int Source, // address of block to move
- int Length // size, in bytes, of block to move
+ int Source, // address of block to move
+ int Length // size, in bytes, of block to move
);
public static final native void MoveMemory (
NMTOOLBAR Destination, // address of move destination
- int Source, // address of block to move
- int Length // size, in bytes, of block to move
+ int Source, // address of block to move
+ int Length // size, in bytes, of block to move
);
public static final native void MoveMemory (
- NMTTDISPINFO Destination, // address of move destination
- int Source, // address of block to move
- int Length // size, in bytes, of block to move
+ NMTTDISPINFO Destination, // address of move destination
+ int Source, // address of block to move
+ int Length // size, in bytes, of block to move
);
public static final native void MoveMemory (
TVITEM Destination, // address of move destination
- int Source, // address of block to move
- int Length // size, in bytes, of block to move
+ int Source, // address of block to move
+ int Length // size, in bytes, of block to move
);
public static final native void MoveMemory (
- WINDOWPOS Destination, // address of move destination
- int Source, // address of block to move
- int Length // size, in bytes, of block to move
+ WINDOWPOS Destination, // address of move destination
+ int Source, // address of block to move
+ int Length // size, in bytes, of block to move
+);
+public static final native void MoveMemory (
+ MSG Destination, // address of move destination
+ int Source, // address of block to move
+ int Length // size, in bytes, of block to move
);
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);
@@ -4373,6 +4397,7 @@ public static final native int SetWindowLong (int hWnd, int nIndex, int dwNewLon
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 SetWindowText (int hWnd, byte [] lpString);
+public static final native int SetWindowsHookEx(int idHook, int lpfn, int hMod, int dwThreadId);
public static final native int SHBrowseForFolder (BROWSEINFO lpbi);
public static final native int ShellExecute (int hwnd, byte [] lpOperation, byte [] lpFile, byte [] lpParameters, byte [] lpDirectory, int nShowCmd);
public static final native int SHGetMalloc (int [] ppMalloc);
@@ -4425,6 +4450,7 @@ public static final native int TranslateAccelerator (
MSG lpMsg // address of structure with message
);
public static final native boolean TranslateMessage (MSG lpmsg);
+public static final native boolean UnhookWindowsHookEx(int hhk);
public static final native boolean UnregisterClass (byte [] lpClassName, int hInstance);
public static final native boolean UpdateWindow (int hWnd);
public static final native boolean ValidateRect (int hWnd, RECT lpRect);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/PAINTSTRUCT.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/PAINTSTRUCT.java
index a0e611c5d2..1113357dc3 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/PAINTSTRUCT.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/PAINTSTRUCT.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class PAINTSTRUCT {
public int hdc;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/POINT.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/POINT.java
index a4fe6d9593..10e63cb6f0 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/POINT.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/POINT.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class POINT {
public int x;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/PRINTDLG.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/PRINTDLG.java
index ecf63a887a..2810a59709 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/PRINTDLG.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/PRINTDLG.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class PRINTDLG {
public int lStructSize; // DWORD
@@ -26,4 +25,4 @@ public class PRINTDLG {
public int hPrintTemplate; // HGLOBAL
public int hSetupTemplate; // HGLOBAL
public static final int sizeof = 66;
-} \ No newline at end of file
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/REBARBANDINFO.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/REBARBANDINFO.java
index 187b3c9ba5..77309f2515 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/REBARBANDINFO.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/REBARBANDINFO.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class REBARBANDINFO {
public int cbSize;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/RECT.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/RECT.java
index 36cf0f7e83..66ad34282c 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/RECT.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/RECT.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class RECT {
public int left;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/SCROLLINFO.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/SCROLLINFO.java
index 9b6cb17b76..bc4872a85a 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/SCROLLINFO.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/SCROLLINFO.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class SCROLLINFO {
public int cbSize;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/SIZE.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/SIZE.java
index 18b415415f..f76a162e49 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/SIZE.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/SIZE.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class SIZE {
public int cx;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/TBBUTTON.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/TBBUTTON.java
index 332d1d497c..35083e4184 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/TBBUTTON.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/TBBUTTON.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class TBBUTTON {
public int iBitmap;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/TBBUTTONINFO.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/TBBUTTONINFO.java
index 8d168db17b..4cb8d1b329 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/TBBUTTONINFO.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/TBBUTTONINFO.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class TBBUTTONINFO {
public int cbSize;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/TCITEM.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/TCITEM.java
index 46685a0770..e8eba369bb 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/TCITEM.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/TCITEM.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class TCITEM {
public int mask;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/TEXTMETRIC.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/TEXTMETRIC.java
index 2f3d5ef306..a1c1f37252 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/TEXTMETRIC.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/TEXTMETRIC.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class TEXTMETRIC {
public int tmHeight;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/TOOLINFO.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/TOOLINFO.java
index 4619f5e943..19b7e2c7c5 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/TOOLINFO.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/TOOLINFO.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class TOOLINFO {
public int cbSize;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/TRACKMOUSEEVENT.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/TRACKMOUSEEVENT.java
index 78fd7044d6..47c09dba4f 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/TRACKMOUSEEVENT.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/TRACKMOUSEEVENT.java
@@ -1,8 +1,8 @@
package org.eclipse.swt.internal.win32;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2000 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class TRACKMOUSEEVENT {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/TVHITTESTINFO.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/TVHITTESTINFO.java
index 5d5d04601b..c987ce7fd3 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/TVHITTESTINFO.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/TVHITTESTINFO.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class TVHITTESTINFO {
// POINT pt;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/TVINSERTSTRUCT.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/TVINSERTSTRUCT.java
index c51bfc7086..8e104640de 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/TVINSERTSTRUCT.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/TVINSERTSTRUCT.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class TVINSERTSTRUCT {
public int hParent;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/TVITEM.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/TVITEM.java
index 81c7caf929..32090afd86 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/TVITEM.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/TVITEM.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class TVITEM {
public int mask;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/WINDOWPLACEMENT.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/WINDOWPLACEMENT.java
index fb3d1853bb..964fefc305 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/WINDOWPLACEMENT.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/WINDOWPLACEMENT.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class WINDOWPLACEMENT {
public int length;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/WINDOWPOS.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/WINDOWPOS.java
index eaa9f5b4a7..35c8b78d69 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/WINDOWPOS.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/WINDOWPOS.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class WINDOWPOS {
public int hwnd;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/WNDCLASSEX.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/WNDCLASSEX.java
index 4d3c7aef8e..4f1ebfb103 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/WNDCLASSEX.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/win32/WNDCLASSEX.java
@@ -1,9 +1,8 @@
package org.eclipse.swt.internal.win32;
/*
- * Licensed Materials - Property of IBM,
- * WebSphere Studio Workbench
- * (c) Copyright IBM Corp 2000
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
public class WNDCLASSEX {
public int cbSize;
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
index a57e681714..82d85ea684 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.*;
@@ -13,7 +13,7 @@ import org.eclipse.swt.events.*;
/**
* Instances of this class represent a selectable user interface object that
- * issues notificiation when pressed and released.
+ * issues notification when pressed and released.
* <dl>
* <dt><b>Styles:</b></dt>
* <dd>ARROW, CHECK, PUSH, RADIO, TOGGLE, FLAT</dd>
@@ -87,6 +87,10 @@ public Button (Composite parent, int style) {
* 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
*
@@ -100,6 +104,7 @@ public Button (Composite parent, int style) {
*
* @see SelectionListener
* @see #removeSelectionListener
+ * @see SelectionEvent
*/
public void addSelectionListener (SelectionListener listener) {
checkWidget ();
@@ -512,7 +517,11 @@ public void setSelection (boolean selected) {
/**
* 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>
@@ -543,11 +552,11 @@ int widgetStyle () {
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;
+ 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;
+ return bits | OS.BS_PUSHBUTTON | OS.WS_TABSTOP;
}
byte [] windowClass () {
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
index a1439d888b..d41b4140b2 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.win32.*;
@@ -21,7 +21,7 @@ import org.eclipse.swt.graphics.*;
* <p>
* This class may be subclassed by custom control implementors
* who are building controls that are <em>not</em> constructed
- * from agregates of other controls. That is, they are either
+ * from aggregates of other controls. That is, they are either
* painted using SWT graphics calls or are handled by native
* methods.
* </p>
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
index 695b05a59a..276cb08483 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.win32.*;
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
index 1e697ca4a7..03ae84c265 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.*;
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
index 04ac440502..9a09f765ff 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.*;
@@ -28,6 +28,9 @@ import org.eclipse.swt.events.*;
* 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>
@@ -36,8 +39,7 @@ import org.eclipse.swt.events.*;
* <dd>DefaultSelection, Modify, Selection</dd>
* </dl>
* <p>
- * IMPORTANT: This class is intended to be subclassed <em>only</em>
- * within the SWT implementation.
+ * IMPORTANT: This class is <em>not</em> intended to be subclassed.
* </p>
*
* @see List
@@ -209,6 +211,10 @@ public void addModifyListener (ModifyListener listener) {
* 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
*
@@ -222,6 +228,7 @@ public void addModifyListener (ModifyListener listener) {
*
* @see SelectionListener
* @see #removeSelectionListener
+ * @see SelectionEvent
*/
public void addSelectionListener(SelectionListener listener) {
checkWidget ();
@@ -473,7 +480,7 @@ public int getItemHeight () {
* <p>
* Note: This is not the actual structure used by the receiver
* to maintain its list of items, so modifying the array will
- * not effect the receiver.
+ * not affect the receiver.
* </p>
*
* @return the items in the receiver's list
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
index e8b6b796c6..dfd48646a4 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.*;
@@ -21,7 +21,7 @@ import org.eclipse.swt.graphics.*;
* </dl>
* <p>
* This class may be subclassed by custom control implementors
- * who are building controls that are constructed from agregates
+ * who are building controls that are constructed from aggregates
* of other controls.
* </p>
*
@@ -136,7 +136,7 @@ void drawBackground (int hdc, RECT rect) {
* <p>
* Note: This is not the actual structure used by the receiver
* to maintain its list of children, so modifying the array will
- * not effect the receiver.
+ * not affect the receiver.
* </p>
*
* @return an array of children
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
index f6caed8759..abe7375db5 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.win32.*;
@@ -17,7 +17,7 @@ import org.eclipse.swt.events.*;
* <dt><b>Styles:</b>
* <dd>BORDER</dd>
* <dt><b>Events:</b>
- * <dd>DoubleClick, FocusIn, FocusOut, Help, KeyDown, KeyUp, MouseDown, MouseEnter,
+ * <dd>FocusIn, FocusOut, Help, KeyDown, KeyUp, MouseDoubleClick, MouseDown, MouseEnter,
* MouseExit, MouseHover, MouseUp, MouseMove, Move, Paint, Resize</dd>
* </dl>
* <p>
@@ -848,9 +848,17 @@ boolean hasCursor () {
}
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;
@@ -2248,11 +2256,21 @@ boolean traverseGroup (boolean next) {
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) {
- if (list [index].setTabGroupFocus () && !isFocusControl ()) return true;
+ Control control = list [index];
+ if (!control.isDisposed () && control.setTabGroupFocus ()) {
+ if (!isDisposed () && !isFocusControl ()) return true;
+ }
}
+ if (group.isDisposed ()) return false;
return group.setTabGroupFocus ();
}
@@ -2264,10 +2282,18 @@ boolean traverseItem (boolean next) {
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.isTabItem () && child.setTabItemFocus ()) return true;
+ if (!child.isDisposed () && child.isTabItem ()) {
+ if (child.setTabItemFocus ()) return true;
+ }
}
return false;
}
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
index 2fe5c21f74..82d52d38da 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.win32.*;
@@ -12,6 +12,14 @@ 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>
@@ -236,7 +244,7 @@ public int getItemCount () {
* <p>
* Note: This is not the actual structure used by the receiver
* to maintain its list of items, so modifying the array will
- * not effect the receiver.
+ * not affect the receiver.
* </p>
*
* @return the receiver's items
@@ -395,7 +403,7 @@ LRESULT wmNotifyChild (int wParam, int lParam) {
* <p>
* Note: This is not the actual structure used by the receiver
* to maintain its list of items, so modifying the array will
- * not effect the receiver.
+ * not affect the receiver.
* </p>
*
* @return the receiver's item order
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
index d23653a8c4..2f273e8017 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.win32.*;
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
index 938e00b119..2ec2522cd6 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.*;
@@ -29,7 +29,7 @@ import org.eclipse.swt.graphics.*;
* no longer maximized.
* </li><li>
* When an instance is in the <em>normal</em> state (neither
- * maximized or minimized), it's appearance is controlled by
+ * 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>
@@ -91,7 +91,7 @@ public class Decorations extends Canvas {
MenuItem [] items;
Control savedFocus;
Button defaultButton, saveDefault;
- int swFlags, hAccel;
+ int swFlags, hAccel, nAccel;
/**
* Prevents uninitialized instances from being created outside the package.
@@ -188,9 +188,8 @@ protected void checkSubclass () {
}
void createAcceleratorTable () {
- hAccel = 0;
- if ((menuBar == null) || (items == null)) return;
- int nAccel = 0;
+ hAccel = nAccel = 0;
+ if (menuBar == null || items == null) return;
int size = ACCEL.sizeof;
ACCEL accel = new ACCEL ();
byte [] buffer1 = new byte [size];
@@ -237,7 +236,7 @@ Control currentTabGroup () {
}
void destroyAcceleratorTable () {
- if ((hAccel != 0) && (hAccel != -1)) OS.DestroyAcceleratorTable (hAccel);
+ if (hAccel != 0 && hAccel != -1) OS.DestroyAcceleratorTable (hAccel);
hAccel = -1;
}
@@ -252,7 +251,7 @@ Menu findMenu (int hMenu) {
MenuItem findMenuItem (int id) {
if (items == null) return null;
- if ((0 <= id) && (id < items.length)) return items [id];
+ if (0 <= id && id < items.length) return items [id];
return null;
}
@@ -663,7 +662,7 @@ public void setImage (Image image) {
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*
- * @see setMinimized
+ * @see #setMinimized
*/
public void setMaximized (boolean maximized) {
checkWidget ();
@@ -721,7 +720,7 @@ public void setMenuBar (Menu menu) {
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*
- * @see setMaximized
+ * @see #setMaximized
*/
public void setMinimized (boolean minimized) {
checkWidget ();
@@ -909,6 +908,16 @@ int widgetStyle () {
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;
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
index 421245adae..1b7a473892 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.*;
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
index 75801d2226..d16ccefca2 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.*;
@@ -98,7 +98,7 @@ public class Display extends Device {
/* Sync/Async Widget Communication */
Synchronizer synchronizer = new Synchronizer (this);
- Thread thread = Thread.currentThread ();
+ Thread thread;
/* Display Shutdown */
Runnable [] disposeList;
@@ -197,6 +197,30 @@ public class Display extends Device {
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>
@@ -328,6 +352,7 @@ int controlKey (int key) {
protected void create (DeviceData data) {
checkSubclass ();
checkDisplay ();
+ thread = Thread.currentThread ();
createDisplay (data);
register ();
if (Default == null) Default = this;
@@ -805,10 +830,16 @@ public Color getSystemColor (int id) {
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); 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); 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);
}
@@ -1043,7 +1074,6 @@ synchronized void register () {
* @see #destroy
*/
protected void release () {
- super.release ();
/* Release shells */
Shell [] shells = WidgetTable.shells ();
@@ -1068,6 +1098,8 @@ protected void release () {
synchronizer = null;
releaseDisplay ();
+
+ super.release ();
}
void releaseDisplay () {
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
index 01529ac9a9..bab97bd83c 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.*;
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
index ca4cdf5719..953ebac445 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.win32.*;
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
index 2d3dc893cf..7731638c91 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.*;
@@ -11,7 +11,7 @@ import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
/**
- * Instances of this class provide by an etched border
+ * Instances of this class provide an etched border
* with an optional title.
* <p>
* Shadow styles are hints and may not be honoured
@@ -178,7 +178,7 @@ boolean mnemonicMatch (char key) {
/**
* Sets the receiver's text, which is the string that will
- * be display as the receiver's <em>title</em>, to the argument,
+ * be displayed as the receiver's <em>title</em>, to the argument,
* which may not be null.
*
* @param text the new text
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
index 8dce0641b9..d44e28e1c5 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.win32.*;
@@ -256,7 +256,15 @@ public void setBackground (int color) {
}
public int size () {
- return OS.ImageList_GetImageCount (handle);
+ 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
index 646486fbdd..2f18c51169 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.*;
@@ -12,8 +12,8 @@ import org.eclipse.swt.graphics.*;
/**
* Instances of this class represent a non-selectable
- * user interface object displays a string or image.
- * When the SEPARATOR is specified, displays a single
+ * 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>
@@ -40,6 +40,34 @@ public class Label extends Control {
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));
}
@@ -340,7 +368,11 @@ public void setImage (Image image) {
/**
* 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>
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
index be29a769b4..13901598a9 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.*;
@@ -36,9 +36,35 @@ public class List extends Scrollable {
OS.GetClassInfoEx (0, ListClass, lpWndClass);
ListProc = lpWndClass.lpfnWndProc;
}
+
/**
-* Creates a new instance of the 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 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));
}
@@ -118,6 +144,10 @@ public void add (String string, int index) {
* 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
*
@@ -131,6 +161,7 @@ public void add (String string, int index) {
*
* @see SelectionListener
* @see #removeSelectionListener
+ * @see SelectionEvent
*/
public void addSelectionListener(SelectionListener listener) {
checkWidget ();
@@ -149,9 +180,6 @@ static int checkStyle (int style) {
return checkBits (style, SWT.SINGLE, SWT.MULTI, 0, 0, 0, 0);
}
-/**
-* Computes the preferred size.
-*/
public Point computeSize (int wHint, int hHint, boolean changed) {
checkWidget ();
int count = OS.SendMessage (handle, OS.LB_GETCOUNT, 0, 0);
@@ -389,6 +417,9 @@ public String getItem (int index) {
* <li>ERROR_WIDGET_DISPOSED - 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 ();
@@ -407,6 +438,9 @@ public int getItemCount () {
* <li>ERROR_WIDGET_DISPOSED - 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 ();
@@ -421,7 +455,7 @@ public int getItemHeight () {
* <p>
* Note: This is not the actual structure used by the receiver
* to maintain its list of items, so modifying the array will
- * not effect the receiver.
+ * not affect the receiver.
* </p>
*
* @return the items in the receiver's list
@@ -431,7 +465,8 @@ public int getItemHeight () {
* <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>
+ * <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 () {
@@ -449,7 +484,7 @@ public String [] getItems () {
* <p>
* Note: This is not the actual structure used by the receiver
* to maintain its selection, so modifying the array will
- * not effect the receiver.
+ * not affect the receiver.
* </p>
* @return an array representing the selection
*
@@ -457,6 +492,10 @@ public String [] getItems () {
* <li>ERROR_WIDGET_DISPOSED - 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 ();
@@ -477,6 +516,9 @@ public String [] getSelection () {
* <li>ERROR_WIDGET_DISPOSED - 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 ();
@@ -500,6 +542,9 @@ public int getSelectionCount () {
* <li>ERROR_WIDGET_DISPOSED - 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 ();
@@ -525,7 +570,7 @@ public int getSelectionIndex () {
* <p>
* Note: This is not the actual structure used by the receiver
* to maintain its selection, so modifying the array will
- * not effect the receiver.
+ * not affect the receiver.
* </p>
* @return the array of indices of the selected items
*
@@ -533,6 +578,9 @@ public int getSelectionIndex () {
* <li>ERROR_WIDGET_DISPOSED - 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 ();
@@ -567,22 +615,24 @@ public int 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 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>
-*/
+ * 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);
@@ -605,6 +655,10 @@ public int indexOf (String string) {
* <li>ERROR_WIDGET_DISPOSED - 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 ();
@@ -678,6 +732,7 @@ public void remove (int [] indices) {
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;
@@ -688,7 +743,7 @@ public void remove (int [] indices) {
if (newFont != 0) oldFont = OS.SelectObject (hDC, newFont);
}
byte [] buffer = null;
- int i = 0, count = 0, last = -1;
+ int i = 0, topCount = 0, last = -1;
while (i < newIndices.length) {
int index = newIndices [i];
if (index != last || i == 0) {
@@ -706,7 +761,7 @@ public void remove (int [] indices) {
OS.DrawText (hDC, buffer, -1, rect, flags);
newWidth = Math.max (newWidth, rect.right - rect.left);
}
- if (index < topIndex) count++;
+ if (index < topIndex) topCount++;
last = index;
}
i++;
@@ -716,11 +771,15 @@ public void remove (int [] indices) {
OS.ReleaseDC (handle, hDC);
setScrollWidth (newWidth, false);
}
- if (count > 0) {
- topIndex -= count;
+ if (topCount > 0) {
+ topIndex -= topCount;
OS.SendMessage (handle, OS.LB_SETTOPINDEX, topIndex, 0);
}
- if (i < newIndices.length) error (SWT.ERROR_ITEM_NOT_REMOVED);
+ if (i < newIndices.length) {
+ int index = newIndices [i];
+ if (0 <= index && index < count) error (SWT.ERROR_ITEM_NOT_REMOVED);
+ error (SWT.ERROR_INVALID_RANGE);
+ }
}
/**
@@ -785,6 +844,7 @@ public void remove (int index) {
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;
@@ -822,7 +882,10 @@ public void remove (int start, int end) {
topIndex -= end - start + 1;
OS.SendMessage (handle, OS.LB_SETTOPINDEX, topIndex, 0);
}
- if (index <= end) error (SWT.ERROR_ITEM_NOT_REMOVED);
+ if (index <= end) {
+ if (0 <= index && index < count) error (SWT.ERROR_ITEM_NOT_REMOVED);
+ error (SWT.ERROR_INVALID_RANGE);
+ }
}
/**
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
index 0bc33f0134..7fb3d9af84 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.win32.*;
@@ -290,7 +290,7 @@ public int getItemCount () {
* <p>
* Note: This is not the actual structure used by the receiver
* to maintain its list of items, so modifying the array will
- * not effect the receiver.
+ * not affect the receiver.
* </p>
*
* @return the items in the receiver
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
index f45f932480..c5a20e530d 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.*;
@@ -13,7 +13,7 @@ import org.eclipse.swt.events.*;
/**
* Instances of this class represent a selectable user interface object
- * that issues notificiation when pressed and released.
+ * that issues notification when pressed and released.
* <dl>
* <dt><b>Styles:</b></dt>
* <dd>CHECK, CASCADE, PUSH, RADIO, SEPARATOR</dd>
@@ -98,6 +98,10 @@ public void addHelpListener (HelpListener listener) {
* 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
*
@@ -111,6 +115,7 @@ public void addHelpListener (HelpListener listener) {
*
* @see SelectionListener
* @see #removeSelectionListener
+ * @see SelectionEvent
*/
public void addSelectionListener (SelectionListener listener) {
checkWidget ();
@@ -582,7 +587,14 @@ LRESULT wmCommandChild (int wParam, int lParam) {
if ((style & (SWT.CHECK | SWT.RADIO)) != 0) {
setSelection (!getSelection ());
}
- postEvent (SWT.Selection);
+ 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/MessageBox.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/MessageBox.java
index 33e6b28bdc..26db85b5d5 100755
--- 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
@@ -1,11 +1,10 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
-/* Imports */
import org.eclipse.swt.internal.*;
import org.eclipse.swt.internal.win32.*;
import org.eclipse.swt.*;
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
index 0855b56930..50384c0c8a 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.win32.*;
@@ -12,7 +12,7 @@ import org.eclipse.swt.graphics.*;
/**
* Instances of the receiver represent is an unselectable
* user interface object that is used to display progress,
- * typlically in the form of a bar.
+ * typically in the form of a bar.
* <dl>
* <dt><b>Styles:</b></dt>
* <dd>SMOOTH, HORIZONTAL, VERTICAL</dd>
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
index 753163958e..bee0bba362 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.win32.*;
@@ -38,6 +38,11 @@ public Sash (Composite parent, int style) {
* 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
*
@@ -51,6 +56,7 @@ public Sash (Composite parent, int style) {
*
* @see SelectionListener
* @see #removeSelectionListener
+ * @see SelectionEvent
*/
public void addSelectionListener (SelectionListener listener) {
checkWidget ();
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
index 3c45f6d06f..f9a74377c9 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.win32.*;
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
index a4259bc2c6..290f65253b 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.win32.*;
@@ -115,6 +115,18 @@ ScrollBar (Scrollable parent, int style) {
* 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
*
@@ -128,6 +140,7 @@ ScrollBar (Scrollable parent, int style) {
*
* @see SelectionListener
* @see #removeSelectionListener
+ * @see SelectionEvent
*/
public void addSelectionListener (SelectionListener listener) {
if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
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
index 0ce4f0ab8d..8417e22a43 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.win32.*;
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
index ab6d498c41..a4267d0697 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.win32.*;
@@ -32,7 +32,7 @@ import org.eclipse.swt.events.*;
* no longer maximized.
* </li><li>
* When an instance is in the <em>normal</em> state (neither
- * maximized or minimized), it's appearance is controlled by
+ * 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>
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
index f072cc0eeb..3bf730b3ac 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.*;
@@ -54,7 +54,7 @@ import org.eclipse.swt.events.*;
* <p>
* IMPORTANT: This class is <em>not</em> intended to be subclassed.
*
- * @see Scrollbar
+ * @see ScrollBar
*/
public class Slider extends Control {
@@ -77,6 +77,18 @@ public Slider (Composite parent, int style) {
* 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
*
@@ -90,6 +102,7 @@ public Slider (Composite parent, int style) {
*
* @see SelectionListener
* @see #removeSelectionListener
+ * @see SelectionEvent
*/
public void addSelectionListener (SelectionListener listener) {
checkWidget ();
@@ -241,7 +254,7 @@ public int getSelection () {
}
/**
- * Answers the size of the receiver's thumb relative to the
+ * Returns the size of the receiver's thumb relative to the
* difference between its maximum and minimum values.
*
* @return the thumb value
@@ -250,8 +263,6 @@ public int getSelection () {
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
- *
- * @see Slider
*/
public int getThumb () {
checkWidget ();
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
index ad6c02dd2a..a768df1577 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.*;
@@ -13,9 +13,17 @@ import org.eclipse.swt.events.*;
/**
* Instances of this class implement the notebook user interface
- * metaphore. It allows the user to select a notebook page from
+ * 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>
@@ -71,6 +79,10 @@ public TabFolder (Composite parent, int style) {
* 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
*
@@ -84,6 +96,7 @@ public TabFolder (Composite parent, int style) {
*
* @see SelectionListener
* @see #removeSelectionListener
+ * @see SelectionEvent
*/
public void addSelectionListener(SelectionListener listener) {
checkWidget ();
@@ -285,7 +298,7 @@ public int getItemCount () {
* <p>
* Note: This is not the actual structure used by the receiver
* to maintain its list of items, so modifying the array will
- * not effect the receiver.
+ * not affect the receiver.
* </p>
*
* @return the items in the receiver
@@ -310,7 +323,7 @@ public TabItem [] getItems () {
* <p>
* Note: This is not the actual structure used by the receiver
* to maintain its selection, so modifying the array will
- * not effect the receiver.
+ * not affect the receiver.
* </p>
* @return an array representing the selection
*
@@ -354,8 +367,7 @@ int imageIndex (Image image) {
}
int index = imageList.indexOf (image);
if (index != -1) return index;
- imageList.add (image);
- return imageList.size () - 1;
+ return imageList.add (image);
}
/**
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
index 6271fa853e..4751b0ff42 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.*;
@@ -155,7 +155,6 @@ public void setImage (Image 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);
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
index d70b459da5..26d1a8ac49 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.win32.*;
@@ -15,6 +15,13 @@ import org.eclipse.swt.events.*;
* 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>
@@ -49,6 +56,13 @@ public Table (Composite parent, int style) {
* 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
*
@@ -62,6 +76,7 @@ public Table (Composite parent, int style) {
*
* @see SelectionListener
* @see #removeSelectionListener
+ * @see SelectionEvent
*/
public void addSelectionListener (SelectionListener listener) {
checkWidget ();
@@ -544,7 +559,7 @@ public int getColumnCount () {
* <p>
* Note: This is not the actual structure used by the receiver
* to maintain its list of items, so modifying the array will
- * not effect the receiver.
+ * not affect the receiver.
* </p>
*
* @return the items in the receiver
@@ -695,7 +710,7 @@ public int getItemHeight () {
* <p>
* Note: This is not the actual structure used by the receiver
* to maintain its list of items, so modifying the array will
- * not effect the receiver.
+ * not affect the receiver.
* </p>
*
* @return the items in the receiver
@@ -743,7 +758,7 @@ public boolean getLinesVisible () {
* <p>
* Note: This is not the actual structure used by the receiver
* to maintain its selection, so modifying the array will
- * not effect the receiver.
+ * not affect the receiver.
* </p>
* @return an array representing the selection
*
@@ -806,7 +821,7 @@ public int getSelectionIndex () {
* <p>
* Note: This is not the actual structure used by the receiver
* to maintain its selection, so modifying the array will
- * not effect the receiver.
+ * not affect the receiver.
* </p>
* @return the array of indices of the selected items
*
@@ -854,8 +869,7 @@ int imageIndex (Image image) {
}
int index = imageList.indexOf (image);
if (index != -1) return index;
- imageList.add (image);
- return imageList.size () - 1;
+ return imageList.add (image);
}
/**
@@ -946,10 +960,37 @@ void releaseWidget () {
}
columns = null;
int itemCount = OS.SendMessage (handle, OS.LVM_GETITEMCOUNT, 0, 0);
- for (int i=0; i<itemCount; i++) {
+
+ /*
+ * 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;
super.releaseWidget ();
if (imageList != null) {
@@ -1068,21 +1109,26 @@ public void remove (int index) {
public void remove (int start, int end) {
checkWidget ();
int count = OS.SendMessage (handle, OS.LVM_GETITEMCOUNT, 0, 0);
- int index = end;
- while (index >= start) {
+ int index = start;
+ while (index <= end) {
ignoreSelect = true;
- int code = OS.SendMessage (handle, OS.LVM_DELETEITEM, index, 0);
+ 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;
+ 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);
+ }
}
- int first = index + 1, last = end + 1;
- System.arraycopy (items, last, items, first, count - last);
- for (int i=count-(last-first); i<count; i++) items [i] = null;
- if (first > start) error (SWT.ERROR_ITEM_NOT_REMOVED);
}
/**
@@ -1096,14 +1142,57 @@ public void remove (int start, int end) {
public void removeAll () {
checkWidget ();
int count = OS.SendMessage (handle, OS.LVM_GETITEMCOUNT, 0, 0);
- 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 ();
+
+ /*
+ * 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);
imageList.dispose ();
@@ -2061,8 +2150,7 @@ 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_MARQUEEBEGIN: return LRESULT.ONE;
case OS.LVN_BEGINDRAG:
case OS.LVN_BEGINRDRAG:
dragStarted = true;
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
index 52bc9a523d..cebb9efac4 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.*;
@@ -75,6 +75,10 @@ public void addControlListener(ControlListener listener) {
* 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
*
@@ -88,6 +92,7 @@ public void addControlListener(ControlListener listener) {
*
* @see SelectionListener
* @see #removeSelectionListener
+ * @see SelectionEvent
*/
public void addSelectionListener (SelectionListener listener) {
checkWidget ();
@@ -154,7 +159,7 @@ public Table getParent () {
* Gets the resizable attribute. A column that is
* not resizable cannot be dragged by the user but
* may be resized by the programmer.
- * <p>
+ *
* @return the resizable attribute
*
* @exception SWTException <ul>
@@ -169,7 +174,7 @@ public boolean getResizable () {
/**
* Gets the width of the receiver.
- * <p>
+ *
* @return the width
*
* @exception SWTException <ul>
@@ -304,7 +309,7 @@ public void setAlignment (int alignment) {
* Sets the resizable attribute. A column that is
* not resizable cannot be dragged by the user but
* may be resized by the programmer.
- * <p>
+ *
* @param resizable the resize attribute
*
* @exception SWTException <ul>
@@ -350,7 +355,7 @@ public void setText (String string) {
/**
* Sets the width of the receiver.
- * <p>
+ *
* @param width the new width
*
* @exception SWTException <ul>
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
index 40f40908a6..05f41b0f21 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.*;
@@ -93,7 +93,6 @@ public Rectangle getBounds (int index) {
* 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
*
@@ -126,7 +125,6 @@ public Display 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
*
@@ -214,7 +212,7 @@ public Rectangle getImageBounds (int index) {
/**
* Gets the image indent.
- * <p>
+ *
* @return the indent
*
* @exception SWTException <ul>
@@ -287,7 +285,6 @@ void releaseWidget () {
/**
* Sets the checked state of the receiver.
- * <p>
*
* @param checked the new checked state
*
@@ -321,7 +318,6 @@ public void setChecked (boolean checked) {
/**
* Sets the grayed state of the receiver.
- * <p>
*
* @param checked the new grayed state
*
@@ -422,7 +418,7 @@ public void setImage (Image image) {
/**
* Sets the image indent.
- * <p>
+ *
* @param indent the new indent
*
* </ul>
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
index e84bc03bf9..bb0b6d99b4 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.*;
@@ -21,7 +21,7 @@ import org.eclipse.swt.events.*;
* <dt><b>Events:</b></dt>
* <dd>DefaultSelection, Modify, Verify</dd>
* </dl>
- * <p>
+ * </p>
* IMPORTANT: This class is <em>not</em> intended to be subclassed.
*/
@@ -95,6 +95,10 @@ public void addModifyListener (ModifyListener listener) {
* 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
*
@@ -108,6 +112,7 @@ public void addModifyListener (ModifyListener listener) {
*
* @see SelectionListener
* @see #removeSelectionListener
+ * @see SelectionEvent
*/
public void addSelectionListener (SelectionListener listener) {
checkWidget ();
@@ -148,6 +153,7 @@ public void addVerifyListener (VerifyListener listener) {
* <p>
* The new text is appended to the text at
* the end of the widget.
+ * </p>
*
* @param string the string to be appended
*
@@ -177,15 +183,12 @@ public void append (String string) {
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;
- }
+ if ((style & (SWT.H_SCROLL | SWT.V_SCROLL)) != 0) return style | SWT.MULTI;
return style | SWT.SINGLE;
}
/**
* Clears the selection.
- * <p>
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
@@ -268,6 +271,7 @@ public Point computeSize (int wHint, int hHint, boolean changed) {
* 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>
@@ -294,6 +298,7 @@ void createWidget () {
* <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>
@@ -316,6 +321,7 @@ int defaultBackground () {
* Gets the line number of the caret.
* <p>
* The line number of the caret is returned.
+ * </p>
*
* @return the line number
*
@@ -336,6 +342,7 @@ public int getCaretLineNumber () {
* Gets the location the caret.
* <p>
* The location of the caret is returned.
+ * </p>
*
* @return a point, the location of the caret
*
@@ -377,6 +384,7 @@ public Point getCaretLocation () {
* Gets the position of the caret.
* <p>
* The character position of the caret is returned.
+ * </p>
*
* @return the position of the caret
*
@@ -400,7 +408,7 @@ public int getCaretPosition () {
/**
* Gets the number of characters.
- * <p>
+ *
* @return number of characters in the widget
*
* @exception SWTException <ul>
@@ -444,6 +452,7 @@ String getClipboardText () {
* 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>
@@ -461,6 +470,7 @@ public boolean getDoubleClickEnabled () {
* 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>
@@ -476,7 +486,6 @@ public char getEchoChar () {
/**
* Gets the editable state.
- * <p>
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
@@ -491,7 +500,7 @@ public boolean getEditable () {
/**
* Gets the number of lines.
- * <p>
+ *
* @return the number of lines in the widget
*
* @exception SWTException <ul>
@@ -506,7 +515,7 @@ public int getLineCount () {
/**
* Gets the line delimiter.
- * <p>
+ *
* @return a string that is the line delimiter
*
* @exception SWTException <ul>
@@ -521,7 +530,7 @@ public String getLineDelimiter () {
/**
* Gets the height of a line.
- * <p>
+ *
* @return the height of a row of text
*
* @exception SWTException <ul>
@@ -548,6 +557,7 @@ public int getLineHeight () {
* 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
*
@@ -569,7 +579,7 @@ public Point getSelection () {
/**
* Gets the number of selected characters.
- * <p>
+ *
* @return the number of selected characters.
*
* @exception SWTException <ul>
@@ -585,7 +595,6 @@ public int getSelectionCount () {
/**
* Gets the selected text.
- * <p>
*
* @return the selected text
*
@@ -611,6 +620,7 @@ public String getSelectionText () {
* 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
*
@@ -641,6 +651,7 @@ int getTabWidth (int tabs) {
* Gets the widget text.
* <p>
* The text for a text widget is the characters in the widget.
+ * </p>
*
* @return the widget text
*
@@ -665,6 +676,7 @@ public String getText () {
* 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
@@ -687,10 +699,11 @@ public String getText (int start, int end) {
}
/**
- * Returns the maximum number of characters that the receiver
- * is capable of holding. If this has not been changed
- * by <code>setTextLimit()</code>, it will be the constant
- * <code>Text.LIMIT</code>.
+ * 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
*
@@ -706,8 +719,10 @@ public int getTextLimit () {
/**
* Returns 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 or removed.
+ * 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
*
@@ -731,9 +746,10 @@ public int getTopIndex () {
* 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><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
*
@@ -770,6 +786,7 @@ boolean getWrap () {
* Inserts a string.
* <p>
* The old selection is replaced with the new text.
+ * </p>
*
* @param string the string
*
@@ -833,6 +850,7 @@ int mbcsToWcsPos (int mbcsPos) {
* <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>
@@ -1028,11 +1046,12 @@ boolean sendKeyEvent (int type, int msg, int wParam, int lParam, Event event) {
/**
* Sets the double click enabled flag.
* <p>
- * @param doubleClick the new double click flag
- *
* 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>
@@ -1047,11 +1066,12 @@ public void setDoubleClickEnabled (boolean doubleClick) {
/**
* Sets the echo character.
* <p>
- * @param echo the new echo character
- *
* 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>
@@ -1072,7 +1092,7 @@ public void setEchoChar (char echo) {
/**
* Sets the editable state.
- * <p>
+ *
* @param editable the new editable state
*
* @exception SWTException <ul>
@@ -1096,11 +1116,10 @@ public void setFont (Font font) {
/**
* 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
@@ -1108,6 +1127,7 @@ public void setFont (Font font) {
* from other functions that address character
* position such as getText () that use the
* regular array indexing rules.
+ * </p>
*
* @param start new caret position
*
@@ -1128,11 +1148,10 @@ public void setSelection (int 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
@@ -1140,6 +1159,7 @@ public void setSelection (int start) {
* 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
@@ -1185,11 +1205,10 @@ public void setRedraw (boolean redraw) {
/**
* 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
@@ -1197,6 +1216,7 @@ public void setRedraw (boolean redraw) {
* from other functions that address character
* position such as getText () that use the
* usual array indexing rules.
+ * </p>
*
* @param selection the point
*
@@ -1220,6 +1240,7 @@ public void setSelection (Point selection) {
* 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
*
@@ -1243,7 +1264,7 @@ void setTabStops (int tabs) {
* number of space widths, depending on the font.
*/
int width = (getTabWidth (tabs) * 4) / (OS.GetDialogBaseUnits () & 0xFFFF);
- OS.SendMessage (handle, OS.EM_SETTABSTOPS, 1, new short [] {(short) width});
+ OS.SendMessage (handle, OS.EM_SETTABSTOPS, 1, new int [] {width});
}
/**
@@ -1335,10 +1356,13 @@ void setWrap (boolean wrap) {
}
/**
- * Shows the selection. If the selection is already showing
+ * 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>
@@ -1591,6 +1615,43 @@ LRESULT WM_PASTE (int wParam, int lParam) {
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;
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
index 07fed35b68..8b5644cb7b 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.win32.*;
@@ -13,9 +13,16 @@ 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</dd>
+ * <dd>FLAT, WRAP, RIGHT, HORIZONTAL, VERTICAL</dd>
* <dt><b>Events:</b></dt>
* <dd>(none)</dd>
* </dl>
@@ -23,7 +30,6 @@ import org.eclipse.swt.graphics.*;
* IMPORTANT: This class is <em>not</em> intended to be subclassed.
* </p>
*/
-
public class ToolBar extends Composite {
ToolItem [] items;
ImageList imageList, disabledImageList, hotImageList;
@@ -36,8 +42,45 @@ public class ToolBar extends Composite {
ToolBarProc = 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 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) {
@@ -47,6 +90,12 @@ int callWindowProc (int msg, int wParam, int lParam) {
static int checkStyle (int style) {
/*
+ * A vertical tool bar cannot wrap because TB_SETROWS
+ * fails when the toobar has TBSTYLE_WRAPABLE.
+ */
+ 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
@@ -62,7 +111,9 @@ protected void checkSubclass () {
public Point computeSize (int wHint, int hHint, boolean changed) {
checkWidget ();
- if (layout != null) return super.computeSize (wHint, hHint, changed);
+ if (layout != null) {
+ return super.computeSize (wHint, hHint, changed);
+ }
int width = 0, height = 0;
RECT oldRect = new RECT ();
OS.GetWindowRect (handle, oldRect);
@@ -186,6 +237,9 @@ void createItem (ToolItem item, int index) {
error (SWT.ERROR_ITEM_NOT_ADDED);
}
items [item.id = id] = item;
+ if ((style & SWT.VERTICAL) != 0) {
+ OS.SendMessage (handle, OS.TB_SETROWS, count+1, 0);
+ }
}
void createWidget () {
@@ -233,6 +287,9 @@ void destroyItem (ToolItem item) {
imageList = hotImageList = disabledImageList = null;
items = new ToolItem [4];
}
+ if ((style & SWT.VERTICAL) != 0) {
+ OS.SendMessage (handle, OS.TB_SETROWS, count-1, 0);
+ }
}
ImageList getDisabledImageList () {
@@ -320,7 +377,7 @@ public int getItemCount () {
* <p>
* Note: This is not the actual structure used by the receiver
* to maintain its list of items, so modifying the array will
- * not effect the receiver.
+ * not affect the receiver.
* </p>
*
* @return the items in the receiver
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
index 6ce098603d..148304d8c2 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.*;
@@ -14,16 +14,16 @@ import org.eclipse.swt.events.*;
/**
* Instances of this class represent a selectable user interface object
* that represents a button in a tool bar.
- * dl>
+ * <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>
+ * </p>
* IMPORTANT: This class is <em>not</em> intended to be subclassed.
*/
-
public class ToolItem extends Item {
ToolBar parent;
Control control;
@@ -49,6 +49,11 @@ public ToolItem (ToolBar parent, int style, int index) {
* 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
*
@@ -62,6 +67,7 @@ public ToolItem (ToolBar parent, int style, int index) {
*
* @see SelectionListener
* @see #removeSelectionListener
+ * @see SelectionEvent
*/
public void addSelectionListener(SelectionListener listener) {
checkWidget();
@@ -123,7 +129,7 @@ public Rectangle getBounds () {
/**
* Returns the control that is used to fill the bounds of
* the item when the items is a <code>SEPARATOR</code>.
- * <p>
+ *
* @return the control
*
* @exception SWTException <ul>
@@ -138,8 +144,10 @@ public Control getControl () {
/**
* Returns the receiver's disabled image if it has one, or null
- * if it does not. The disabled image is displayed when the
- * receiver is disabled.
+ * if it does not.
+ * <p>
+ * The disabled image is displayed when the receiver is disabled.
+ * </p>
*
* @return the receiver's disabled image
*
@@ -161,9 +169,11 @@ public Display 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.
+ * <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
*
@@ -181,8 +191,10 @@ public boolean getEnabled () {
/**
* Returns the receiver's hot image if it has one, or null
- * if it does not. The hot image is displayed when the mouse
- * enters the receiver.
+ * if it does not.
+ * <p>
+ * The hot image is displayed when the mouse enters the receiver.
+ * </p>
*
* @return the receiver's hot image
*
@@ -218,6 +230,7 @@ public ToolBar getParent () {
* 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
*
@@ -235,8 +248,7 @@ public boolean getSelection () {
}
/**
- * Returns the receiver's tool tip text, or null if it has
- * not been set.
+ * Returns the receiver's tool tip text, or null if it has not been set.
*
* @return the receiver's tool tip text
*
@@ -252,7 +264,7 @@ public String getToolTipText () {
/**
* Gets the width of the receiver.
- * <p>
+ *
* @return the width
*
* @exception SWTException <ul>
@@ -271,9 +283,11 @@ public int getWidth () {
/**
* 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.
+ * <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
*
@@ -330,7 +344,7 @@ public void removeSelectionListener(SelectionListener listener) {
/**
* Sets the control that is used to fill the bounds of
* the item when the items is a <code>SEPARATOR</code>.
- * <p>
+ *
* @param control the new control
*
* @exception SWTException <ul>
@@ -352,9 +366,12 @@ public void setControl (Control control) {
/**
* Enables the receiver if the argument is <code>true</code>,
- * and disables it otherwise. A disabled control is typically
+ * 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
*
@@ -370,12 +387,15 @@ public void setEnabled (boolean enabled) {
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. The
- * disbled image is displayed when the receiver is disabled.
+ * null indicating that no disabled image should be displayed.
+ * <p>
+ * The disbled image is displayed when the receiver is disabled.
+ * </p>
*
* @param image the hot image to display on the receiver (may be null)
*
@@ -393,8 +413,10 @@ public void setDisabledImage (Image image) {
/**
* Sets the receiver's hot image to the argument, which may be
- * null indicating that no hot image should be displayed. The
- * hot image is displayed when the mouse enters the receiver.
+ * 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)
*
@@ -423,6 +445,7 @@ public void setImage (Image image) {
* 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
*
@@ -489,7 +512,7 @@ public void setToolTipText (String string) {
/**
* Sets the width of the receiver.
- * <p>
+ *
* @param width the new width
*
* @exception SWTException <ul>
@@ -529,8 +552,11 @@ void updateImages () {
if (disabledImageList == null) disabledImageList = new ImageList ();
Image disabled = disabledImage;
if (disabledImage == null) {
- Color color = parent.getBackground ();
- disabled = disabledImage2 = createDisabledImage (image, color);
+ disabled = image;
+ if (!getEnabled ()) {
+ Color color = parent.getBackground ();
+ disabled = disabledImage2 = createDisabledImage (image, color);
+ }
}
disabledImageList.add (disabled);
parent.setDisabledImageList (disabledImageList);
@@ -548,8 +574,11 @@ void updateImages () {
disabledImage2 = null;
disabled = disabledImage;
if (disabledImage == null) {
- Color color = parent.getBackground ();
- disabled = disabledImage2 = createDisabledImage (image, color);
+ disabled = image;
+ if (!getEnabled ()) {
+ Color color = parent.getBackground ();
+ disabled = disabledImage2 = createDisabledImage (image, color);
+ }
}
}
disabledImageList.put (info.iImage, disabled);
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
index 4ee8413cfb..9f38cd17df 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.win32.*;
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
index b52dada557..bc471fcf39 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.win32.*;
@@ -15,6 +15,13 @@ import org.eclipse.swt.events.*;
* 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>
@@ -25,7 +32,6 @@ import org.eclipse.swt.events.*;
* IMPORTANT: This class is <em>not</em> intended to be subclassed.
* </p>
*/
-
public class Tree extends Composite {
int hAnchor;
TreeItem [] items;
@@ -41,7 +47,34 @@ public class Tree extends Composite {
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));
}
@@ -51,6 +84,12 @@ public Tree (Composite parent, int style) {
* 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
*
@@ -64,6 +103,7 @@ public Tree (Composite parent, int style) {
*
* @see SelectionListener
* @see #removeSelectionListener
+ * @see SelectionEvent
*/
public void addSelectionListener(SelectionListener listener) {
checkWidget ();
@@ -395,7 +435,7 @@ public int getItemHeight () {
* <p>
* Note: This is not the actual structure used by the receiver
* to maintain its list of items, so modifying the array will
- * not effect the receiver.
+ * not affect the receiver.
* </p>
*
* @return the number of items
@@ -450,7 +490,7 @@ public TreeItem getParentItem () {
* <p>
* Note: This is not the actual structure used by the receiver
* to maintain its selection, so modifying the array will
- * not effect the receiver.
+ * not affect the receiver.
* </p>
* @return an array representing the selection
*
@@ -555,8 +595,7 @@ int imageIndex (Image image) {
}
int index = imageList.indexOf (image);
if (index != -1) return index;
- imageList.add (image);
- return imageList.size () - 1;
+ return imageList.add (image);
}
void releaseItems (TreeItem [] nodes, TVITEM tvItem) {
@@ -829,9 +868,9 @@ public void setSelection (TreeItem [] items) {
checkWidget ();
if (items == null) error (SWT.ERROR_NULL_ARGUMENT);
- /* Select/deselect the first item */
+ /* Select/deselect the first item */
+ int hOldItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0);
if (items.length == 0) {
- int hOldItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0);
if (hOldItem != 0) {
TVITEM tvItem = new TVITEM ();
tvItem.mask = OS.TVIF_STATE;
@@ -846,6 +885,21 @@ public void setSelection (TreeItem [] items) {
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;
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
index 6049d1ae68..2933fe5fb0 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.*;
@@ -12,7 +12,8 @@ import org.eclipse.swt.graphics.*;
/**
* Instances of this class represent a selectable user interface object
- * that represents a heirarchy of tree items in a tree widget.
+ * that represents a hierarchy of tree items in a tree widget.
+ *
* <dl>
* <dt><b>Styles:</b></dt>
* <dd>(none)</dd>
@@ -219,7 +220,7 @@ public int getItemCount () {
* <p>
* Note: This is not the actual structure used by the receiver
* to maintain its list of items, so modifying the array will
- * not effect the receiver.
+ * not affect the receiver.
* </p>
*
* @return the receiver's items
@@ -419,6 +420,11 @@ public void setImage (Image image) {
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);
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
index a8cd271360..a6874b5463 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.*;
@@ -15,7 +15,7 @@ import java.util.EventListener;
/**
* This class is the abstract superclass of all user interface objects.
* Widgets are created, disposed and issue notification to listeners
- * when events occur which effect them.
+ * when events occur which affect them.
* <dl>
* <dt><b>Styles:</b></dt>
* <dd>(none)</dd>
@@ -298,7 +298,7 @@ protected void checkSubclass () {
* </p><p>
* In future releases of SWT, there may be more or fewer error
* checks and exceptions may be thrown for different reasons.
- * <p>
+ * </p>
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
@@ -320,7 +320,7 @@ protected void checkWidget () {
* 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><p>
* This method is called after <code>releaseWidget</code>.
* </p>
* @see #dispose
@@ -446,6 +446,7 @@ public Object getData (String key) {
* 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
*
@@ -533,6 +534,7 @@ boolean hooks (int eventType) {
* 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
*/
@@ -584,6 +586,7 @@ boolean isValidThread () {
* and <code>false</code> otherwise.
* <p>
* Note: This method is no longer required and will be deprecated.
+ * </p>
*
* @return <code>true</code> when the widget is not disposed and <code>false</code> otherwise
*
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
index 4157cb2bdc..816b496751 100755
--- 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
@@ -1,8 +1,8 @@
package org.eclipse.swt.widgets;
/*
- * Licensed Materials - Property of IBM,
- * (c) Copyright IBM Corp. 1998, 2001 All Rights Reserved
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
*/
import org.eclipse.swt.internal.win32.*;
diff --git a/bundles/org.eclipse.swt/build.properties.common b/bundles/org.eclipse.swt/build.properties.common
new file mode 100755
index 0000000000..2af74c346f
--- /dev/null
+++ b/bundles/org.eclipse.swt/build.properties.common
@@ -0,0 +1,8 @@
+build.vaj.Eclipse\ SWT\ Custom\ Widgets=Eclipse SWT Custom Widgets/common
+build.includes=plugin.xml,plugin.jars,build.properties,buildnotes_swt.html
+
+source.ws/win32/swt.jar=Eclipse SWT/win32,Eclipse SWT/common,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
+source.ws/motif/swt.jar=Eclipse SWT/motif,Eclipse SWT/common,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
+source.ws/gtk/swt.jar=Eclipse SWT/gtk,Eclipse SWT/common,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
+source.ws/photon/swt.jar=Eclipse SWT/photon,Eclipse SWT/common,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
+bin.includes=plugin.xml,ws/
diff --git a/bundles/org.eclipse.swt/build.properties.motif b/bundles/org.eclipse.swt/build.properties.motif
new file mode 100755
index 0000000000..9096484541
--- /dev/null
+++ b/bundles/org.eclipse.swt/build.properties.motif
@@ -0,0 +1,5 @@
+build.vaj.Eclipse\ SWT=Eclipse SWT/common,Eclipse SWT/motif
+build.vaj.Eclipse\ SWT\ Drag\ and\ Drop=Eclipse SWT Drag and Drop/common,Eclipse SWT Drag and Drop/motif
+build.vaj.Eclipse\ SWT\ Printing=Eclipse SWT Printing/common,Eclipse SWT Printing/motif
+build.vaj.Eclipse\ SWT\ Program=Eclipse SWT Program/common,Eclipse SWT Program/motif
+build.includes=ws/motif \ No newline at end of file
diff --git a/bundles/org.eclipse.swt/build.properties.photon b/bundles/org.eclipse.swt/build.properties.photon
new file mode 100755
index 0000000000..072feb6f17
--- /dev/null
+++ b/bundles/org.eclipse.swt/build.properties.photon
@@ -0,0 +1,5 @@
+build.vaj.Eclipse\ SWT=Eclipse SWT/common,Eclipse SWT/photon
+build.vaj.Eclipse\ SWT\ Drag\ and\ Drop=Eclipse SWT Drag and Drop/common,Eclipse SWT Drag and Drop/photon
+build.vaj.Eclipse\ SWT\ Printing=Eclipse SWT Printing/common,Eclipse SWT Printing/photon
+build.vaj.Eclipse\ SWT\ Program=Eclipse SWT Program/common,Eclipse SWT Program/photon
+build.includes=ws/photon \ No newline at end of file
diff --git a/bundles/org.eclipse.swt/build.properties.win32 b/bundles/org.eclipse.swt/build.properties.win32
new file mode 100755
index 0000000000..d87bb9905f
--- /dev/null
+++ b/bundles/org.eclipse.swt/build.properties.win32
@@ -0,0 +1,7 @@
+build.vaj.Eclipse\ SWT=Eclipse SWT/common,Eclipse SWT/win32
+build.vaj.Eclipse\ SWT\ AWT=Eclipse SWT AWT/win32
+build.vaj.Eclipse\ SWT\ Drag\ and\ Drop=Eclipse SWT Drag and Drop/common,Eclipse SWT Drag and Drop/win32
+build.vaj.Eclipse\ SWT\ OLE\ Win32=Eclipse SWT OLE Win32/win32
+build.vaj.Eclipse\ SWT\ Printing=Eclipse SWT Printing/common,Eclipse SWT Printing/win32
+build.vaj.Eclipse\ SWT\ Program=Eclipse SWT Program/common,Eclipse SWT Program/win32
+build.includes=ws/win32 \ No newline at end of file
diff --git a/bundles/org.eclipse.swt/buildnotes_swt.html b/bundles/org.eclipse.swt/buildnotes_swt.html
new file mode 100755
index 0000000000..7069179099
--- /dev/null
+++ b/bundles/org.eclipse.swt/buildnotes_swt.html
@@ -0,0 +1,1173 @@
+<!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 Release Notes - SWT</title>
+</head>
+<body>
+
+<h1>
+Eclipse Platform Build Notes<br>
+SWT</h1>
+SWT Build 125 - Friday June 15, 2001
+
+<h2>
+<a NAME="Problem reports fixed"></a>Problem reports fixed</h2>
+
+<blockquote>
+1GFBHX6: SWT:ALL - CTabItem tool tip flashing
+<br>1GF9YHD: ITPUI:WIN2000 - SWTException: help view
+<br>1GETDP5: ITPUI:Linux - NPE while closing editor on linux
+</blockquote>
+
+<h1>
+Eclipse Platform Build Notes<br>
+SWT</h1>
+SWT Build 124 - Thursday June 14, 2001
+
+<h2>
+<a NAME="Problem reports fixed"></a>Problem reports fixed</h2>
+
+<blockquote>
+1GFB6OX: SWT:WINNT - VAJ - Display does not compile clear because of visibility problem
+<br>1GF9W2U: SWT:WINNT - StyledText - fix "bad" words
+<br>1GF6ENQ: SWT:WINNT - Workbench window loses focus when combo activated in toolbar
+<br>1GF2TGG: ITPUI:WIN2000 - SWTException: Navigator view
+<br>1GEYJM0: ITPJUI:ALL - StyledText: undo in editor wipes out the content
+</blockquote>
+
+<h1>
+Eclipse Platform Build Notes<br>
+SWT</h1>
+SWT Build 123 - Wednesday June 13, 2001
+
+<h2>
+<a NAME="Problem reports fixed"></a>Problem reports fixed</h2>
+
+<blockquote>
+1GF6EHD: SWT:WINNT - ControlView does not implement setFocus()
+<br>1GF0U20: ITPCORE:WIN - remove -verify from the exe
+<br>1GEWYRM: SWT:Neutrino - Text.MULTI doesn't send focus gained events
+<br>1GETC4I: SWT:ALL - DCR - outstanding issue for customer- Translate accelerator of a Control or Decorations widget
+</blockquote>
+
+<h1>
+Eclipse Platform Build Notes<br>
+SWT</h1>
+SWT Build 122 - Saturday June 9, 2001
+
+<h2>
+<a NAME="Problem reports fixed"></a>Problem reports fixed</h2>
+
+<blockquote>
+1GEVBEV: SWT:Linux - Enabling composite & children does not work
+<br>1GEZO05: ITPUI:ALL - Autoscroll in Navigator on d&d does not always work
+</blockquote>
+
+<h1>
+Eclipse Platform Build Notes<br>
+SWT</h1>
+SWT Build 121 - Friday June 8, 2001
+
+<h2>
+<a NAME="Problem reports fixed"></a>Problem reports fixed</h2>
+
+<blockquote>
+1GEYXLY: SWT:Linux - NPE from Table.isColumnResize
+<br>1GBRNBE: SWT:ALL - DOC: Changes to existing docs
+</blockquote>
+
+<h1>
+Eclipse Platform Build Notes<br>
+SWT</h1>
+SWT Build 120 - Thursday June 7, 2001
+
+<h2>
+<a NAME="Problem reports fixed"></a>Problem reports fixed</h2>
+
+<blockquote>
+1GEYAPA: SWT:Linux - NullPointerException in ToolItem
+<br>1GEUUVX: SWT:Linux - Hover help does not work in text editor
+<br>1GEUTGB: SWT:WIN - Hover help does not work over error icons (red X's)
+<br>1GEUTDF: SWT:WIN - ArrayIndexOutOfBounds in TypeInfoBrowser example
+<br>1GETHBH: SWT:ALL - Severe - Can not read readme gifs
+<br>1GETD1I: SWT:Linux - GP running Launcher/HelloW example
+<br>1GETCBC: SWT:Linux - Popup menu fix could be improved
+<br>1GETCAY: SWT:ALL - SEVERE - outstanding issue for customer- Filename length bug in the FileDialog widget
+<br>1GETC0S: SWT:ALL - SEVERE - outstanding issue for customer - hosting activeX control in control widget
+<br>1GETAUF: ITPJUI:WIN2000 - Cursor stuck as Busy Cursor when"cancel" adding jar
+<br>1GET96Q: ITPUI:Linux - Cannot identify editor input on linux
+<br>1GENXQ8: SWT:Neutrino - List.select() does not ignore out of range indexes
+<br>1GELSXB: SWT:Linux - Code Assist window goes away as soon as I release mouse button
+<br>1GELNMX: SWT:Linux - Build path order page: table column not sized correctly
+<br>1GEAEF0: ITPUI:Linux - SEVERE: Drag one file on to another deletes the first file
+<br>1GE6XQA: ITPDUI:Linux - Resuming stopped at each frame on unwind
+</blockquote>
+
+<h1>
+Eclipse Platform Build Notes<br>
+SWT</h1>
+SWT Build 118 - Saturday June 2, 2001
+<h2>
+<a NAME="API Changes"></a>API Changes</h2>
+
+<h3>
+<a NAME="SWT Examples are now a plugin"></a>SWT Examples are now a plugin</h3>
+SWT examples run as a plugin in the Eclipse desktop.
+<p>To run the examples, follow these steps:
+<ol>
+<li>
+Perspective -> Show View -> Other...</li>
+
+<li>
+In the Show View dialog, expand the topmost SWT Examples category.</li>
+
+<li>
+Select "Launcher" and click OK to get the SWT Launcher view.</li>
+
+<li>
+From this view, you can launch all of the SWT Examples, including both
+stand-alone examples (10 of them) and plugin examples (3 of them: Controls,
+Paint, &amp; OLE).</li>
+</ol>
+<b>Notes:</b>
+<ul>
+<li>
+Select an example in the launcher list to see a description of the example.</li>
+
+<li>
+Press the Run button or double-click the example to launch it.</li>
+
+<li>
+If the example has a source jar (i.e. the plugin examples have source jars),
+then press Add to Workspace to add the source to a project in your workspace.</li>
+
+<li>
+An alternate way to launch the Controls, Paint, &amp; OLE examples, since
+they are plugins, is to select them from Perspective -> Show View -> Other...</li>
+</ul>
+
+<h2>
+<a NAME="Problem reports fixed"></a>Problem reports fixed</h2>
+
+<blockquote>1GEPBX8: SWT:Linux - Adding a new entry to a tool bar overwrites
+the first entry 1GEPAFQ: ITPUI:Linux - Using 'open perspective' button
+replaces button with new perspective 1GEM261: SWT:ALL - CCombo still has
+focus when invisible 1GELK0B: ITPUI:Linux - No popup menu on shortcut bar
+tools? 1GEJIKJ: SWT:Linux - Depth 2 PNGs cause unspecified error 1GEAS7V:
+ITPUI:Linux - ToolItem image does not update 1GE8ZKY: ITPJUI:Linux - Content
+assist not working on Linux 1GE5F2Y: ITPUI:Linux - No popup-menu over perspectives
+in left column 1GD0L49: SWT:Linux - Popup menus do not work in Toolbar
+1G95PJ6: ITPUI:WIN2000 - Changing task priority loses task selection</blockquote>
+
+<h1>
+Eclipse Platform Build Notes<br>
+SWT</h1>
+SWT Build 117 - Friday June 1, 2001
+<h2>
+<a NAME="Problem reports fixed"></a>Problem reports fixed</h2>
+
+<blockquote>1GENQD3: SWT:ALL - Character conversion broken for wide characters.
+<br>1GELTSI: SWT:WIN2000 - Tree does not update properly when images disposed
+and re-set
+<br>1GELNIG: SWT:WIN2000 - Tree item selection not shown if same item previously
+cleared
+<br>1GELNDR: SWT:WIN2000 - eclipse.exe is not killed
+<br>1GEASNK: SWT:Linux - Double-clicking '+' or '-' collapses whole tree
+<br>1GEAMLV: ITPUI:WIN98 - Tab Folder tabs show duplicate
+<br>1GE4XB5: ITPUI:WIN2000 - JavaDoc for SWT SelectionEvent is unclear
+<br>1GDX9PN: ITPUI:WINNT - ArrayIndexOutOfBounds in Console/StyledText
+<br>1GDVHI9: ITPUI:ALL - Editor tab not drawn on file open (editor area
+hidden)
+<br>1GDQAVN: ITPUI:Linux - Eclipse crashing copying text
+<br>1GCHTAP: SWT:Linux - Font logic doesn't handle unknown fonts appropritately
+<br>1G9TX2I: SWT:Linux - Interlaced GIF gives X error on X
+<br>1G4IUX6: SWT:Linux - X Error of failed request: BadDrawable</blockquote>
+
+<h1>
+Eclipse Platform Build Notes<br>
+SWT</h1>
+SWT Build 116 - Thursday May 31, 2001
+<h2>
+<a NAME="Problem reports fixed"></a>Problem reports fixed</h2>
+
+<blockquote>1GEJNQV: SWT:WIN - Table performance on dispose.
+<br>1GEAALG: SWT:WIN2000 - CCombo gives too many focus in focus out events
+<br>1GDF8U8: SWT:Linux - The Drop-down list can't display in Tasks of Eclipse
+<br>1GD7J2T: SWT:WINNT - Not getting key events from CCombo
+<br>1GCTD2T: ITPJUI:WIN2000 - Rename type dialog has name scrolled</blockquote>
+
+<h1>
+Eclipse Platform Build Notes<br>
+SWT</h1>
+SWT Build 115 - Wednesday May 30, 2001
+<h2>
+<a NAME="Problem reports fixed"></a>Problem reports fixed</h2>
+
+<blockquote>1GEGPCA: SWT:ALL - Exception for hover-help
+<br>1GEGF7L: SWT:ALL - Program.execute does not handle cases without %1
+<br>1GEEG7A: SWT:WIN2000 - IndexOutOfBounds in styledText
+<br>1GEAPRQ: ITPUI:Linux - Window loses focus when editor tooltip appears
+<br>1GE8XP9: SWT:Linux - SIGSEGV using code assist
+<br>1GE8K1W: SWT:Linux - MessageBox does not wrap text.</blockquote>
+
+<h1>
+Eclipse Platform Build Notes<br>
+SWT</h1>
+SWT Build 114 - Tuesday May 29, 2001
+<h2>
+<a NAME="Problem reports fixed"></a>Problem reports fixed</h2>
+
+<blockquote>1GEGFFW: SWT:Linux - Exception comparing gif files
+<br>1GEGF7L: SWT:ALL - Program.execute does not handle cases without %1
+<br>1GEG8HB: SWT:ALL - DCR - support VERTICAL toolbar
+<br>1GE8LZX: SWT:Linux - Segmentation Fault using a text widget
+<br>1GE8LOW: SWT:Linux - bogus exception thrown in Cursor constructor.
+<br>1GE75IM: SWT:Linux - BadDrawable in X_GetGeometry when resize window
+<br>1GDTNST: SWT:WIN2000 - Table.remove(int,int) does not check bounds
+<br>1GDS5G6: SWT:Linux - Program for .html files does not parse commands
+properly
+<br>1GDRWIL: ITPUI:ALL - Exception in the Navigator in Japanese
+<br>1GDD38J: ITPUI:ALL - Quick Start: The tab does not visit the Cancel
+command button.
+<br>1GD0KUB: SWT:Linux - Double-clicking in table just deselects item
+<br>1GCN5RI: SWT:Linux - Closing sample1.readme does not remove button
+until moving mouse
+<br>1GALH3B: SWT:Linux - GC.copyArea causes an X-Error
+<br>1GAL4QA: SWT:Linux - Graphics components causing GPF's
+<br>1G9TX4I: SWT:WIN - ImageAnalyzer hangs on interlaced animated GIF
+<br>1G9GBP8: SWT:WINNT - GC.drawString() check for null, GC.drawText()
+doesn't
+<br>1G5YXG0: SWT:ALL - Walkback scaling a small image to be really small
+<br>1G5WZR6: SWT:ALL - Disposed Image objects should throw consistent errors
+<br>1GEG8FT: SWT:ALL - Custom widgets do not handle dispose correctly.</blockquote>
+
+<h1>
+Eclipse Platform Build Notes<br>
+SWT</h1>
+SWT Build 112 - Thursday May 24, 2001
+<h2>
+<a NAME="Problem reports fixed"></a>Problem reports fixed</h2>
+
+<blockquote>1GE75O4: SWT:Linux - Missing libXm.so.2 in last build
+<br>1GE6XTM: SWT:Linux - Tooltips always appear in the same place
+<br>1GE6NVD: SWT:ALL - StyledText.setRedraw(boolean) does not work as expected
+<br>1GE56QT: SWT:ALL - ToolItem creates disabled image when not needed
+<br>1GE4KPU: SWT:ALL - PNG reading error
+<br>1GE3D5X: SWT:Linux - NPE when Image disposed before GC
+<br>1GDW5PA: SWT:ALL - javadoc errors in org.eclipse.swt
+<br>1GDQDPW: SWT:Neutrino - More mouse up events fired than mouse downs
+<br>1GDQ855: SWT:Neutrino - GC.stringExtent() returns incorrect value for
+empty string
+<br>1GDO85F: SWT:WINNT - Minor javadoc typo
+<br>1GDDE87: SWT:WIN2000 - ToolItem: setImage() before setDisabledImage()
+does more work
+<br>1GCN4CP: SWT:Linux - Tooltips at screen border on Linux
+<br>1G7AJ6K: SWT:Neutrino - problem with visibility of child shell when
+parent is not visible</blockquote>
+
+<h1>
+Eclipse Platform Build Notes<br>
+SWT</h1>
+SWT Build 110 - Tuesday May 22, 2001
+<h2>
+<a NAME="Problem reports fixed"></a>Problem reports fixed</h2>
+
+<blockquote>&nbsp;
+<br>1GE2ZDR: SWT:WINNT - List comments need updating
+<br>1GE2L8G: ITPJUI:WIN2000 - Editor screen cheese on import assist
+<br>1GDXG5O: ITPSRCEDIT:WIN2000 - Syntax not highlighted when searching
+<br>1GDXFRX: ITPSRCEDIT:WIN2000 - Syntax not highlighted when previous
+character is selected
+<br>1GDWZTD: ITPJUI:WINNT - Refreshing problems in editor
+<br>1GDWYXP: ITPJUI:WIN2000 - Still get incorrect rendered Java Files</blockquote>
+
+<h1>
+Eclipse Platform Build Notes<br>
+SWT</h1>
+SWT Build 108 - Thursday May 17, 2001
+<h2>
+<a NAME="API Changes"></a>API Changes</h2>
+
+<h3>
+<a NAME="SWT in its own plugin"></a>SWT in its own plugin</h3>
+SWT is now in its own plugin called org.eclipse.swt. The jars and dll/library
+files are now located in this new plugin folder. Formerly, the SWT classes
+were included in the workbench.jar and the dll/libraries were located in
+the org.eclipse.ui plugin.
+<p><b>NOTE:</b> You may need to change some of your scripts that invoke
+SWT examples to point at the new jar and dll/lib location. Also, when you
+launch UI Main you must specify the windowing system in the command line
+using the "-ws&nbsp;<windowing system>" argument. For example, on windows,
+eclipse.bat now has the following appearance:
+<pre>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .\jre\bin\java -verify -cp startup.jar org.eclipse.core.launcher.UIMain -application org.eclipse.ui.workbench -ws win32 %1 %2 %3 %4 %5 %6 %7 %8 %9</pre>
+
+<h3>
+<a NAME="Styled Text"></a>Styled Text</h3>
+The following API changes have been made to StyledText:
+<p>If you are implementing your own StyledTextContent implementation, the
+semantics of how to handle replaceTextRange have changed. Instead of modifying
+your content and then sending the TextChangedEvent with how the text was
+changed, one must now:
+<ol>
+<li>
+send the TextChangingEvent (with how the text is to be modified)</li>
+
+<li>
+change your text model content</li>
+
+<li>
+send the TextChangedEvent</li>
+</ol>
+The code changes for this are as follows:
+<ul>
+<li>
+renamed:</li>
+
+<ul>
+<li>
+StyledTextContent.addTextChangedListener -> addTextChangeListener</li>
+
+<li>
+StyledTextContent.removeTextChangedListener -> removeTextChangeListener</li>
+</ul>
+
+<li>
+new:</li>
+
+<ul>
+<li>
+TextChangingEvent</li>
+
+<li>
+TextChangeListener, methods to implement</li>
+
+<ul>
+<li>
+textChanging(TextChangingEvent)</li>
+
+<li>
+textChanged(TextChangedEvent)</li>
+
+<li>
+textSet(TextChangedEvent)</li>
+</ul>
+</ul>
+
+<li>
+removed:</li>
+
+<ul>
+<li>
+All fields of TextChangedEvent, data will be in the TextChangingEvent,
+differences as follows:</li>
+
+<ul>
+<li>
+int start;</li>
+
+<li>
+String newText; (vs. replacedText)</li>
+
+<li>
+int replaceCharCount; (renamed from replace<d>CharCount)</li>
+
+<li>
+int newCharCount;</li>
+
+<li>
+int replaceLineCount; (renamed from replace<d>LineCount)</li>
+
+<li>
+int newLineCount;</li>
+</ul>
+
+<li>
+TextChangedListener</li>
+</ul>
+</ul>
+
+<h2>
+<a NAME="Problem reports fixed"></a>Problem reports fixed</h2>
+
+<blockquote>1FV0NUA: SWT:WINNT - Exception loading jpg
+<br>1GCHMCZ: SWT:ALL - TabFolder.setLayout should not do anything
+<br>1GC2Y4C: ITPJUI:WINNT - Editor does not correctly refresh
+<br>1GCSZGA: SWT:Linux - Drop down items on ToolBar do not work.
+<br>1GDH148: SWT:ALL - StyledText - flash when mouse select on empty line.
+<br>1GDRSKQ: SWT:ALL - ViewForm calls setVisible incorrectly</blockquote>
+
+<h1>
+Eclipse Platform Build Notes<br>
+SWT</h1>
+SWT Build 106 - Monday May 14, 2001
+<h2>
+<a NAME="Problem reports fixed"></a>Problem reports fixed</h2>
+
+<blockquote>1GD0H51: ITPJUI:Linux - Java Build Path properties page walkback</blockquote>
+
+<h1>
+Eclipse Platform Build Notes<br>
+SWT</h1>
+SWT Build 105 - Thursday May 10, 2001
+<h2>
+<a NAME="Problem reports fixed"></a>Problem reports fixed</h2>
+
+<blockquote>1GDH5XA: SWT:Linux - Shell deactivate Event not fired
+<br>1GDGWW9: SWT:WIN2000 - Converter @param tags missing var name for terminate
+<br>1GDGN75: SWT:WIN2000 - Table should reset image list if no items
+<br>1GDCYE3: ITPJUI:WINNT - all perspectives corrupted
+<br>1GDCSRP: SWT:WINNT - Reading PNG streams having 2-bit image depth
+<br>1GD7UBX: SWT:WINNT - Trivial error in TableEditor class comment
+<br>1GD46XF: SWT:WIN2000 - Since build 048, Label widget has no left margin
+for text
+<br>1GBQ19X: SWT:WIN2000 - Problems with context menu lifecycle</blockquote>
+
+<h1>
+Eclipse Platform Build Notes<br>
+SWT</h1>
+SWT Build 104 - Monday May 7, 2001
+<h2>
+<a NAME="What's new"></a>What's new in this drop</h2>
+
+<h3>
+<a NAME="Behaviour Changes"></a>Behaviour Changes</h3>
+
+<ul>
+<li>
+StyledText was incorrectly changing the cursor to a busy cursor when performing
+a copy or paste. Setting the cursor is the responsibility of the application.</li>
+</ul>
+
+<h3>
+<a NAME="API Changes"></a>API Changes</h3>
+
+<ul>
+<li>
+StyledText.print() has been added.</li>
+
+<li>
+Printer support has been added.</li>
+</ul>
+
+<h2>
+<a NAME="Problem reports fixed"></a>Problem reports fixed</h2>
+
+<blockquote>1GD7MK9: SWT:WINNT - Cheese in label when setting a different
+size image and changing the bounds in the layout
+<br>1GD63XZ: SWT:WIN2000 - exit eclipse workbench throws exception
+<br>1GD5ZND: SWT:WINNT - Label ignoring setAlignment method call
+<br>1GD0LO7: ITPUI:Linux - External files given wrong path
+<br>1GD0BZR: SWT:Linux - StyledText: I-beam cursor cheese when scrolling
+<br>1GBPPQW: ITPJUI:WIN2000 - Tab width is 2 instead of 4
+<br>1GBOBBO: SWT:ALL - Should check in Display methods if display is disposed
+<br>1GBCXQA: SWT:Linux - Cannot paste to single-line Text widget
+<br>1GAP5O4: SWT:ALL - DCR: Printing API and implementation</blockquote>
+
+<h1>
+Eclipse Platform Build Notes<br>
+SWT</h1>
+SWT Build 103 - Thursday May 3, 2001
+<h2>
+<a NAME="Problem reports fixed"></a>Problem reports fixed</h2>
+
+<blockquote>1GD4KNI: SWT:WIN2000 - TableEditor.setColumn(int) has off-by-one
+error
+<br>1GD45AU: SWT:Linux - UnsatisfiedLinkError gnome_mime_type
+<br>1GD3XC2: SWT:WIN - GC.dispose() doesn't fully clean up - leaves itself
+in image
+<br>1GD3M6G: ITPUI:WIN2000 - SWT Error when closing Workbench
+<br>1GD3LD6: ITPUI:WINNT - Exception closing a second workbench window
+<br>1GD3FWL: ITPJUI:WINNT - walkback on closing the workbench
+<br>1GCV0HC: SWT:WIN2000 - TreeItem::setExpanded does not trigger selection
+change?
+<br>1GBOADO: SWT:WIN - WIN - Clean up after RichText removal
+<br>1GCN531: SWT:WIN2000 - CTabFolder child's visibility is false on notification</blockquote>
+
+<h1>
+Eclipse Platform Build Notes<br>
+SWT</h1>
+SWT Build 102 - Tuesday May 1, 2001
+<h2>
+<a NAME="Problem reports fixed"></a>Problem reports fixed</h2>
+
+<blockquote>1GD0J8V: SWT:Linux - NPE setting background pixel on label
+<br>1GD0BTL: SWT:Linux - Cursor doesn't blink unless you move the mouse
+<br>1GCUT5I: SWT:ALL - ViewForm::setBorderVisible() does not draw properly
+<br>1GCUIH2: SWT:Linux - NPE on image dispose setting label background
+color
+<br>1GCPHMP: SWT:Linux - GC.copyArea results in X_ClearArea error when
+regions are disjoint
+<br>1GAZZ7F: SWT:ALL - package com.ibm.itp.os.* should be renamed</blockquote>
+
+<h1>
+Eclipse Platform Build Notes<br>
+SWT</h1>
+SWT Build 100 - Thursday April 26, 2001
+<p><b>Renaming of packages and projects to org.eclipse version</b>
+<h1>
+Eclipse Platform Build Notes<br>
+SWT</h1>
+SWT Build 075 - Thursday April 26, 2001
+<h2>
+<a NAME="Problem reports fixed"></a>Problem reports fixed</h2>
+
+<blockquote>1GCQU7S: SWT:WINNT - Exception getting image pixel
+<br>1GCQPTX: SWT:WINNT - Gradient colour is black on WINNT
+<br>1GCQKWP: SWT:WINNT - ImageData corrupt for certain images
+<br>1GCP2JE: SWT:WINNT - Exception collapsing the parent of an item with
+a TreeEditor open
+<br>1GCP11O: SWT:WINNT - TreeEditor created too far left</blockquote>
+
+<h1>
+Eclipse Platform Build Notes<br>
+SWT</h1>
+SWT Build 074 - Tuesday April 24, 2001
+<h2>
+<a NAME="Problem reports fixed"></a>Problem reports fixed</h2>
+
+<blockquote>1GCGDPB: SWT:Linux - Table column resize
+<br>1GCGA89: SWT:ALL - CLabel tool tip does not always update properly
+<br>1GCG3O2: SWT:WIN - NullPointerException when closing window
+<br>1GCG1TY: SWT:WIN2000 - Label.setImage(null) doesn't work and background
+does not show through
+<br>1GCFUMC: SWT:ALL - CTabFolder X button not centered
+<br>1GBZEZ2: SWT:ALL - CTabItem is not showing tool tip.
+<br>1FVEUN9: SWT:Linux - Expand all problems operation in LF is slow
+<br>1FMRW6Q: SWT:UNIX - Tree/Table don't repaint on setForeground()</blockquote>
+
+<h1>
+Eclipse Platform Build Notes<br>
+SWT</h1>
+SWT Build 073 - Thursday April 19, 2001
+<h2>
+<a NAME="What's new"></a>What's new in this drop</h2>
+
+<h3>
+<a NAME="Behaviour Changes"></a>Behaviour Changes</h3>
+
+<ul>
+<li>
+FocusIn and FocusOut events sent for OleControlSite and OleClientSite</li>
+</ul>
+
+<h3>
+<a NAME="API Changes"></a>API Changes</h3>
+
+<ul>
+<li>
+Support for the following system colors has been added:</li>
+
+<ul>
+<li>
+SWT.COLOR_TITLE_FOREGROUND</li>
+
+<li>
+SWT.COLOR_TITLE_BACKGROUND</li>
+
+<li>
+SWT.COLOR_TITLE_BACKGROUND_GRADIENT</li>
+
+<li>
+SWT.COLOR_TITLE_INACTIVE_FOREGROUND</li>
+
+<li>
+SWT.COLOR_TITLE_INACTIVE_BACKGROUND</li>
+
+<li>
+SWT.COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT</li>
+</ul>
+
+<li>
+CTabFolder.setInsertMark(int index, boolean after) added</li>
+
+<li>
+CTabFolder.setInsertMark(CTabItem item, boolean after) added</li>
+
+<li>
+CTabFolder.setSelectionForeground(Color color) added</li>
+
+<li>
+CTabFolder.setBackground(Image image) deprecated - use CTabFolder.setSelectionBackground(Image
+image)</li>
+
+<li>
+CTabFolder.setBackground(Color[] colors, int[] percents) deprecated - use
+CTabFolder.setSelectionBackground(Color[] colors, int[] percents)</li>
+</ul>
+
+<h2>
+<a NAME="Problem reports fixed"></a>Problem reports fixed</h2>
+
+<blockquote>1GCC93K: SWT:ALL - Should SWT be issuing selection event when
+tab item added?
+<br>1GCC7G8: SWT:Linux - scrolled to far left when opening CTabFolder
+<br>1GCALVS: SWT:WIN - Button.computeSize() not correct for radio buttons
+w/ 48 point font
+<br>1GC3YIG: SWT:WIN - FileDialog chooses a bogus initial filterExtension
+<br>1GBPOYG: ITPJUI:WIN2000 - Editor tabs are changing size when switching
+between different tabs
+<br>1GB2373: SWT:WINNT - Menu help callback: widget is destroyed
+<br>1GAW5MX: SWT:WINNT - Shell calls saveFocus after firing deactivate
+event
+<br>1G9X2Z4: SWT:WINNT - GIF transparent color not transparent
+<br>1G3ESH6: SWT:ALL - GIFs with transparency problems
+<br>1G0V4WM: J9JCL:WINNT - Transparency index vs Transparency color...</blockquote>
+
+<h1>
+Eclipse Platform Build Notes<br>
+SWT</h1>
+SWT Build 072 - Tuesday April 17, 2001
+<h2>
+<a NAME="What's new"></a>What's new in this drop</h2>
+
+<h3>
+<a NAME="API Changes"></a>API Changes</h3>
+
+<ul>
+<li>
+CLabel.setBackground(Image image) added</li>
+
+<li>
+CTabFolder.setBackground(Image image) added</li>
+</ul>
+
+<h2>
+<a NAME="Problem reports fixed"></a>Problem reports fixed</h2>
+
+<blockquote>1GCA2T3: SWT:WINNT - Program.getImageData() has NumberFormatException
+<br>1GAJCZU: ITPJUI:WINNT - segmented viewer toolbar icon shows up in random
+places
+<br>1GBPGMO: ITPJUI:WINNT - Create package toolbar icon is wrong
+<br>1GBXHID: SWT:Linux - NullPointerException disposing Color
+<br>1GC1AEN: SWT:Linux - Walkback during shutdown on linux</blockquote>
+
+<h1>
+Eclipse Platform Build Notes<br>
+SWT</h1>
+SWT Build 071 - Thursday April 12, 2001
+<h2>
+<a NAME="What's new"></a>What's new in this drop</h2>
+
+<h3>
+<a NAME="API Changes"></a>API Changes</h3>
+
+<ul>
+<li>
+Tracker.open() now returns a boolean - false when tracking cancelled.</li>
+
+<li>
+added Display.getSyncThread() for core</li>
+</ul>
+
+<h2>
+<a NAME="Problem reports fixed"></a>Problem reports fixed</h2>
+
+<blockquote>1GC182H: SWT:Neutrino - Bug in error checking in GC.drawImage()
+<br>1GBXGV0: SWT:ALL - DCR: No api on Tracker to know escape key pressed
+<br>1GBRRGA: SWT:WIN2000 - TableTree: Mouse selection on text toggles checkbox
+<br>1GBPLGT: ITPJUI:WINNT - Can't enter umlauts in JavaEditor
+<br>1GBPI4O: SWT:WIN2000 - Losing close box of Editor
+<br>1GBOC3W: SWT:Linux - Problem with Mask when drawing on image
+<br>1GBADIS: SWT:ALL - minimumSize gives wrong size in Composite which
+result in wrong behavior of calculateSize() and pack()
+<br>1GALCDN: SWT:WIN98 - GC keeps line width set at 0
+<br>1G97CWG: SWT:Linux - Wiggly mouse
+<br>1G82MBI: IVJIDT:WIN98 - GPF (repeatable) - 3.5.3 - when terminating
+running java code - editing running code</blockquote>
+
+<h1>
+Eclipse Platform Build Notes<br>
+SWT</h1>
+SWT Build 070 - Tuesday April 10, 2001
+<h2>
+<a NAME="Problem reports fixed"></a>Problem reports fixed</h2>
+
+<blockquote>1GBR8U9: SWT:WIN2000 - SashForm.setMaximizedControl problem
+<br>1GBQ145: SWT:WIN2000 - broken implementation of ViewForm.layout
+<br>1GBM11E: SWT:WIN2000 - ViewForm border problems
+<br>1GBR6XI: SWT:WIN2000 - SashForm overrides wrong layout method
+<br>1GBRCNC: SWT:WIN2000 - Layout problems with SashForm &amp; ViewForm
+<br>1G98NJQ: ITPJUI:WIN2000 - Outliner context menu disappears after empty
+selection
+<br>1GBM8SZ: SWT:WIN2000 - SashForm doesn't work in wizard pages
+<br>1GBKSNP: SWT:Linux - Control.setForeground does not redraw control
+<br>1GBLZDR: SWT:WIN2000 - Label text moves up when pane titlebar splits
+<br>1GBPPLT: ITPJUI:WIN2000 - Strange line spacing in Java Editor
+<br>1GBQ54Q: SWT:Linux - MenuItems are not added in the right position.
+<br>1GBRBTY: SWT:WIN2000 - SashForm clips bottom most control by one pixel
+<br>1GBRC0V: SWT:WIN2000 - ViewForm renders a "title bar" also none of
+the top controls are set
+<br>1GBRCGL: SWT:WIN2000 - Animated Progress shows up with slider in ProgressDialog
+<br>1GBX8G1: SWT:Neutrino - Default font support doesn't capture style,
+height
+<br>1GBX8LN: SWT:WIN2000 - Tree.getSelection() iterates over all items
+twice if selection is empty</blockquote>
+
+<h1>
+Eclipse Platform Build Notes<br>
+SWT</h1>
+SWT Build 069 - Thursday April 5, 2001
+<h2>
+<a NAME="What's new"></a>What's new in this drop</h2>
+
+<h3>
+<a NAME="API Changes"></a>API Changes</h3>
+
+<ul>
+<li>
+The class RichText has been removed. Use com.ibm.swt.custom.StyledText
+instead.</li>
+
+<li>
+The class com.ibm.itp.os.ProgramSupport has been deprecated because it
+was a random assortment of helper methods some of which Windows specific
+and could not be implemented on other platforms. The functionality has
+been redistributed as follows:</li>
+
+<ul>
+<li>
+ProgramSupport.getWindowSystem - use SWT.getPlatform</li>
+
+<li>
+ProgramSupport.isReparentable - use Control.isReparentable</li>
+
+<li>
+ProgramSupport.print - RichText no longer exists</li>
+
+<li>
+ProgramSupport.getFriendlyName - not used</li>
+
+<li>
+ProgramSupport.loadLargeIcon - not used</li>
+
+<li>
+ProgramSupport.loadSmallIcon - use Program.getImageData</li>
+
+<li>
+ProgramSupport.queryExtension - use Program.findProgram</li>
+
+<li>
+ProgramSupport.queryExtensionIcon - use Program.getImageData</li>
+
+<li>
+ProgramSupport.queryExtensionProgramID - use OLE.findProgramID</li>
+
+<li>
+ProgramSupport.queryInsertables - not used</li>
+
+<li>
+ProgramSupport.queryRegisteredPrograms - use Program.getPrograms</li>
+
+<li>
+ProgramSupport.shellExecute - use Program.launch</li>
+</ul>
+
+<li>
+OleClientSite.containsOleInfo has been deprecated - use OLE.isOleFile</li>
+
+<li>
+The methods Control.isValidWidget, Widget.isValidWidget and Menu.isValidWidget
+have been removed.</li>
+</ul>
+
+<h2>
+<a NAME="Known deficiencies"></a>Known deficiencies</h2>
+
+<ul>
+<li>
+The support for running Swing and AWT widgets within SWT layouts only works
+on Windows. There are currently significant incompatibilities between the
+way AWT and SWT deal with Motif. There is no workaround at this time.</li>
+
+<li>
+TableEditors are not notified when the cell they are editing changes its
+dimensions. This can cause them to look odd when the underlying table (or
+one of its columns) is resized while they are open. This occurs on both
+Windows and Linux. In addition, because of the way XWindows handles child
+widgets, it is possible for TableEditors to lose focus on Linux in situations
+where they do not on Windows. Simply clicking on the TableEditor again,
+will return focus to it.</li>
+</ul>
+
+<h2>
+<a NAME="Problem reports fixed"></a>Problem reports fixed</h2>
+
+<blockquote>1GBLZLL: SWT:WINNT - NegativeArraySizeException in SashForm
+<br>1GBKN67: SWT:WINNT - StyledText - paste replacing text does not show
+new text
+<br>1GBKERA: SWT:ALL - Typo in BusyIndicator.showWhile - 'Dusplay'
+<br>1GBKCLF: SWT:WINNT - StyledText - IllegalArgumentException in DefaultContent.getLine
+<br>1GBF77D: SWT:WINNT - getFontData().getHeight() discrepancy
+<br>1GBF74Z: SWT:ALL - CLabel::onPaint exception
+<br>1GBEI94: ITPUI:WIN2000 - Walkback in AnimatedProgress
+<br>1GBD9LZ: SWT:ALL - CTabFolder exception using scroll arrows
+<br>1GBD356: SWT:ALL - TabItem.setControl(null) throws NullPointerException
+<br>1GB9GZD: SWT:Linux - Motif - Color depth scaling
+<br>1FT97NJ: SWT:Linux - Tree/Table turns item grey when focus lost</blockquote>
+
+<h1>
+Eclipse Platform Build Notes<br>
+SWT</h1>
+SWT Build 063 through SWT Build 068 - Thursday March 29, 2001
+<h2>
+<a NAME="What's new"></a>What's new in this drop</h2>
+
+<h3>
+<a NAME="New Classes"></a>New Classes</h3>
+
+<ul>
+<li>
+<b>SashForm</b> 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.</li>
+
+<li>
+<b>StackLayout</b> 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.</li>
+</ul>
+
+<h3>
+<a NAME="API Changes"></a>API Changes</h3>
+
+<li>
+Widget.notifyListener deleted - Use Widget.notifyListeners</li>
+
+<li>
+SelectionAdapter.widgetDoubleSelected deleted - Use SelectionAdapter.widgetDefaultSelected
+instead</li>
+
+<li>
+SelectionListener.widgetDoubleSelected deleted - Use SelectionListener.widgetDefaultSelected
+instead</li>
+
+<li>
+SWT.DoubleSelection deleted - Use SWT.DefaultSelection instead.</li>
+
+<li>
+WidgetListener deleted - Use DisposeListener instead.</li>
+
+<li>
+Widget.addWidgetListener deleted - Use Widget.addDisposeListener instead.</li>
+
+<li>
+Widget.removeWidgetListener deleted - Use Widget.removeDisposeListener
+instead</li>
+
+<li>
+SWT.ERROR_NO_COMMON_PARENT deleted</li>
+
+<li>
+Clipboard.Clipboard() deleted - Use Clipboard.Clipboard(Display) instead</li>
+
+<li>
+DragSource.startDrag() deleted - Use DragSourceListener.dragStart instead</li>
+
+<li>
+GridLayout.id deleted</li>
+
+<li>
+ImageData.DM_UNSPECIFIED deleted</li>
+
+<li>
+ImageData.DM_FILL_NONE deleted</li>
+
+<li>
+ImageData.DM_FILL_BACKGROUND deleted</li>
+
+<li>
+ImageData.DM_FILL_PREVIOUS deleted</li>
+
+<li>
+ImageData.isIcon() deleted</li>
+
+<li>
+com.ibm.swt.custom.CustomLabel deleted - Use CLabel instead</li>
+
+<li>
+com.ibm.swt.custom.CustomPane deleted - Use ViewForm instead</li>
+
+<li>
+com.ibm.swt.custom.ScrollingComposite deleted - Use ScrolledComposite instead</li>
+
+<p><br><b>***NOTE***</b> There has been some renaming of Interface methods,
+which will unavoidably break code while the rename is being done. In order
+to make it easier for yourself before we rename next week, you might want
+to do the rename in your copy of SWT after you get tomorrow's drop, and
+fix all breakage immediately.
+<br><b>***NOTE2***</b> in general, you always want to try to use an Adapter
+(when one exists) instead of implementing the corresponding Listener. This
+will insulate you from changes to the interface. Also, we have seen cases
+where an SWT event Listener interface is being implemented by a public
+class. This not only exposes your public class to interface changes, but
+it also forces your public class to bogusly provide the SWT Listener interface's
+methods as your public API. <i>Don't do that.</i>
+<h3>
+<a NAME="Styled Text changes"></a>Styled Text changes</h3>
+
+<ul>
+<li>
+StyledText</li>
+
+<br>For those who are implementing StyledTextContent, the constructor for
+the TextChangedEvent class has changed. The TextChangedEvent() constructor
+no longer exists. Use the TextChangedEvent(StyledTextContent source) constructor
+instead.
+<b>NOTE:</b> The parameter to this constructor cannot be null.</ul>
+<b>These StyledText methods have been renamed:</b>
+<ul>
+<li>
+StyledText.getSelection() ==> use getSelectionRange() instead</li>
+
+<li>
+StyledText.getText(int start, int length) ==> use getTextRange(int,int)
+instead</li>
+
+<li>
+StyledTextContent.getText(int start, int length) ==> use getTextRange(int,int)
+instead</li>
+
+<li>
+StyledText.redraw(int,int,boolean) ==> use redrawRange(int,int,boolean)
+instead</li>
+
+<li>
+StyledText.replace(int start, int length) ==> use replaceTextRange(int,int)
+instead</li>
+
+<li>
+StyledTextContent.replaceText(int start, int length) ==> use replaceTextRange(int,int)
+instead</li>
+
+<li>
+StyledText.setSelection(int start, int length) ==> use setSelectionRange(int,int)
+instead</li>
+</ul>
+<b>These methods have been introduced to maintain SWT API consistency.</b>
+<p>StyledText selection methods used to take (int start, int length) and
+now the parameters are (int start, int end).
+<p><b>WARNING</b>These names are the same as the old names, BUT the semantics
+have changed. Also note that in the case of setSelection(start,end) the
+behavior has also changed to be consistent with SWT (the selection is made
+visible):
+<ul>
+<li>
+StyledText.getSelection() ==> returns Point(start,end)</li>
+
+<li>
+StyledText.getText(int start, int end)</li>
+
+<li>
+StyledText.setSelection(int start, int end)</li>
+</ul>
+The compiler is not going to point these changes out automatically. You
+can decide whether to use the new "selection range" API with (start, length)
+semantics, or stick with the old method names and change your calling semantics
+to (start, end). We suggest you use the following trick to get the compiler
+to help you make the changes:
+<ol>
+<li>
+Make sure you have SWT 0.067 loaded.</li>
+
+<li>
+Rename the 3 StyledText methods, getSelection, getText, and setSelection,
+to getSelection2, getText2, and setSelection2.</li>
+
+<li>
+You will now have red x's everywhere you called those methods.</li>
+
+<li>
+Make the changes (either change to call getSelectionRange/getTextRange/setSelectionRange,
+or change to use "start, end").</li>
+
+<li>
+Replace the 3 StyledText methods with the released version.</li>
+</ol>
+<b>These deprecated methods have been removed from StyledText:</b>
+<ul>
+<li>
+StyledText.getCaretLineNumber()</li>
+
+<li>
+StyledText.getCaretLocation()</li>
+
+<li>
+StyledText.getCaretPosition()</li>
+
+<li>
+StyledText.getDelimiter()</li>
+
+<li>
+StyledText.getDoubleClick()</li>
+
+<li>
+StyledText.setDoubleClick(boolean)</li>
+
+<li>
+StyledText.setSelectionForeground (Color color)</li>
+
+<li>
+StyledText.setSelectionVisible(boolean visible)</li>
+
+<li>
+StyledText.setText(String string, Color colors [], int [] ranges)</li>
+</ul>
+<b>These deprecated methods have been undeprecated:</b>
+<ul>
+<li>
+StyledText.append (String string)</li>
+
+<li>
+StyledText.insert (String string)</li>
+
+<li>
+StyledText.getLineCount ()</li>
+
+<li>
+StyledText.selectAll()</li>
+
+<li>
+StyledText.getSelectionCount()</li>
+
+<li>
+StyledText.setSelection (int start)</li>
+
+<li>
+StyledText.setSelection(Point point)</li>
+</ul>
+The method invokeAction(int) is now public. You may use this method to
+support special key binding needs like multi-keystroke bindings or macro
+recording/playback.
+<h3>
+<a NAME="Other highlights"></a>Other highlights</h3>
+
+<ul>
+<li>
+The ability to set a Disabled image for use in the Toolbar has been added.</li>
+
+<li>
+The ability to create a new gray scale image from a color image has been
+added.</li>
+
+<pre>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Image grayImage = new Image(getDisplay(), colorImage, SWT.IMAGE_GRAY)</pre>
+</ul>
+
+<h2>
+<a NAME="Known deficiencies"></a>Known deficiencies</h2>
+
+<ul>
+<li>
+The support for running Swing and AWT widgets within SWT layouts only works
+on Windows. There are currently significant incompatibilities between the
+way AWT and SWT deal with Motif. There is no workaround at this time.</li>
+
+<li>
+TableEditors are not notified when the cell they are editing changes its
+dimensions. This can cause them to look odd when the underlying table (or
+one of its columns) is resized while they are open. This occurs on both
+Windows and Linux. In addition, because of the way XWindows handles child
+widgets, it is possible for TableEditors to lose focus on Linux in situations
+where they do not on Windows. Simply clicking on the TableEditor again,
+will return focus to it.</li>
+</ul>
+
+<h2>
+<a NAME="Problem reports fixed"></a>Problem reports fixed</h2>
+
+<blockquote>&nbsp;
+<br><b>In 68:</b>
+<br>1GBCTBY: SWT:ALL - DCR: Make 3 border rgb color public
+<br>1GBCSHG: SWT:WIN2000 - TableTree should have getItem(Point point)
+<br>1GBB8NJ: SWT:ALL - StyledText - caret not updated when Modify is sent
+<br>1GB9FJB: SWT:ALL - DCR: CTabFolder close icon not "transparent"
+<br>1GB9F5O: SWT:ALL - DCR: Empty CTabFolder border drawing
+<br>1GB93QT: SWT:WIN - StyledText - blt problem when cutting text
+<br>1GAWIAP: SWT:WINNT - StyledText - key bindings - make doAction() public
+<br>1GAVQGI: SWT:ALL - Migrate remaining JFace widgets
+<br>1GAVQA6: SWT:ALL - Notebook custom widget
+<br>1GAJ9KP: SWT:ALL - TableTree class has no selection support for the
+SWT.CHECK style
+<br>1G5T37N: SWT:Linux - Table repaints excessively
+<br>&nbsp;
+<p><b>In 67:</b>
+<br>1GB1VFN: SWT:Neutrino - Cannot "swipe select" text in Text (SINGLE
+style)
+<br>1GB0DAQ: SWT:Neutrino - Calling getText() on a Button of style CHECK
+causes an exception
+<br>1GAZU5I: SWT:ALL - TableTree - order of items is wrong when first opened
+<br>1GAXJIG: SWT:WIN2000 - Why does the new BusyIndiocator need a display
+passed in
+<br>1GAUU7N: SWT:ALL - StyledText - SWT API Compliance
+<br>1GAU7AO: SWT:ALL - Increase max VTable size
+<br>1GAQREA: SWT:ALL - DOC: Using SWT Layouts
+<br>1GAPCPB: SWT:ALL - StyledText: last line slurs when scrolling
+<br>1GAP7II: SWT:ALL - DCR - CTabItem visual enhancements
+<br>1G6ZJXO: SWT:WINNT - Changing the visibility of a Splitter's child
+doesn't work
+<br>1G54RZE: SWT:WINNT - GC.drawImage(Image, int, int) too slow
+<br>1G0I960: SWT:WINNT - GC.drawImage newing Objects, could be much faster
+<br>&nbsp;
+<p><b>In 66:</b>
+<br>1GAX9NB: SWT:Neutrino - Combo dropdown erased when MouseEnter/Exit
+hooked on Container
+<br>1GAWHN7: SWT:WIN2000 - computeSize on toolbar makes it Visible
+<br>1GAW64X: SWT:WIN2000 - Most setters of ViewForm are broken
+<br>1GAUR6V: SWT:WIN - "Hot Images in ToolBar" does not work if items are
+disabled
+<br>1GAPCG7: SWT:ALL - StyledText: inefficiencies when redrawing multiple
+lines
+<br>1GAP46W: SWT:ALL - ViewForm activeBorder not always visible
+<br>1GAP36M: SWT:ALL - CLabel::setBackgroundGradient does not redraw
+<br>1G8VVLS: SWT:ALL - DCR: Need an API to get the color of a pixel at
+a point on the Desktop
+<br>1G2O4LD: SWT:ALL - Need API to take a screen snapshot
+<br>&nbsp;
+<p><b>In 65:</b>
+<br>1GAUEK1: SWT:WIN2000 - Context menus get never removed from the shell
+<br>1GAP7DE: SWT:ALL - OLE editor go gray when deactivated
+<br>1GAP2VP: SWT:ALL - Background gradient api diff for CTabFolder &amp;
+CLabel
+<br>1GAL0ES: SWT:WINNT - Menu item help callback does not occur until after
+menu is down
+<br>1GAJBTA: ITPJUI:WINNT - walkback when editing java file
+<br>1GAJ9GX: SWT:ALL - combo box never receives an event for an "enter"
+key
+<br>1G8IU7A: SWT:ALL - new alpha APIs on ImageData
+<br>1G8HBF8: SWT:Neutrino - Alpha problems with off-screen graphics
+<br>1G7YWTN: SWT:Neutrino - No KeyDown or KeyUp for multi-line text
+<br>1G7MIEJ: SWT:WINNT - notification of enter &amp; double click
+<br>1G7GHRM: SWT:WIN98 - prop sheet - second column does not fit
+<br>1G7EQ69: SWT:Neutrino - No KeyUp messages sent
+<br>1G55SCR: SWT:Neutrino - List.getItemHeight() completely bogus
+<br>1G54XZT: SWT:WINNT - Combo box - can't tell if someone hits&nbsp;<Enter>
+<br>1FT06EX: SWT:ALL - FileDialog.setFilterExtensions() does not properly
+degrade on non Windows platforms
+<br>1FSY6QR: SWT:WINNT - DCR - FileDialog API should better balance platform
+function vs. portability
+<br>1FMGL58: SWT:WIN - Single-line TextEditor does not send event when&nbsp;<Enter>is
+pressed
+<br>1FBPLB5: SWT:ALL - List(SINGLE) - setSelection and selectAll inconsistent
+<br>1FBPKD9: SWT:WIN - List - selectAll() setSelection() inconsistancy
+when items repeat
+<br>1FBPKCY: SWT:WIN - List - inconsistent setSelection() behaviour
+<br>&nbsp;
+<p><b>In 63:</b>
+<br>1GABZR5: SWT:Linux - Table cheese when removing last column
+<br>1G9XBWB: SWT:ALL - DOC: Layout class still has Smalltalk-style comments
+<br>1G7PMZX: SWT:ALL - notifyListener should be called notifyListeners
+<br>1G7AQDI: SWT:Neutrino - Font() constructor should use PfGenerateFontName()
+<br>1G4DGHG: SWT:Linux - Thumb drag scrolling causes cheese
+<br>1FZU2X2: SWT:ALL - Why is DisposeListener called "WidgetListener"?
+<br>1FVX5JS: SWT:WINNT - PaletteData.getPixel(RGB) needs to be fixed
+<br>1FT05NQ: SWT:ALL - DCR FileDialog.setFilterExtensions() doesn't support
+common Windows usage
+<br>1FCDRW0: SWT:AIX - TrackBar - setPageIncrement()</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/plugin.jars b/bundles/org.eclipse.swt/plugin.jars
new file mode 100755
index 0000000000..01b2a14a49
--- /dev/null
+++ b/bundles/org.eclipse.swt/plugin.jars
@@ -0,0 +1,7 @@
+swt.jar=\
+ Eclipse SWT Drag and Drop,\
+ Eclipse SWT,\
+ Eclipse SWT OLE Win32,\
+ Eclipse SWT Custom Widgets, \
+ Eclipse SWT Program,\
+ Eclipse SWT Printing \ No newline at end of file
diff --git a/bundles/org.eclipse.swt/plugin.xml b/bundles/org.eclipse.swt/plugin.xml
new file mode 100755
index 0000000000..2f3b714c78
--- /dev/null
+++ b/bundles/org.eclipse.swt/plugin.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- File written by PDE 1.0 -->
+<plugin
+ id="org.eclipse.swt"
+ name="SWT"
+ version="0.9"
+ provider-name="Object Technology International, Inc.">
+
+<!-- Runtime -->
+<runtime>
+ <library name="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
new file mode 100755
index 0000000000..da2ccbe4c5
--- /dev/null
+++ b/bundles/org.eclipse.swt/readme_swt.html
@@ -0,0 +1,102 @@
+<!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. All Rights Reserved.
+<h3>
+Table Of Contents</h3>
+&nbsp;1. Known Issues
+<h3>
+99.1 Known Issues</h3>
+<h4>
+99.1.1 Wheel Mouse</h4>
+
+SWT does not directly handle the extended messages sent by the wheel mouse.
+If the correct driver is installed for the wheel mouse, the extended messages are mapped to
+cursor operations that are supported.
+
+<h4>
+99.1.2 Resource usage on Windows 98</h4>
+
+Although SWT is not inherently a heavy consumer of Windows GDI resources, applications that make
+extensive use of images may potentially cause the system to become resource limited on Windows 98
+and Windows Me. Efforts were made to minimize the impact of this in Eclipse, however, opening
+several perspectives can still cause it to happen. Further work in this area is ongoing.
+
+<h4>
+99.1.3 Available Colors on 8-bit Linux</h4>
+
+Typically, in Gnome Linux installs running with 8 bit plain 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.4 Motif Accelerators</h4>
+
+Keyboard accelerators on motif are sensitive to the state of all modifier keys such as the Caps Lock,
+Num Lock and Scroll Lock keys. For example, Ctrl 'S' is not the same as Ctrl 'S' with the Num Lock key on.
+If keyboard accelerators appear to not be working, please check the state of all other modifier keys.
+
+<h4>
+99.1.5 Printing Support</h4>
+
+Although printing is not used by Eclipse, SWT provides printing support on Win32 platforms.
+See org.eclipse.swt.printing for more information.
+
+<h4>
+99.1.6 Drag and Drop on Motif</h4>
+
+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 multi-threaded (i.e. XInitThreads), which we have not yet been
+able to workaround.
+
+<h4>
+99.1.7 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.7 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.8 SWT Example (Standalone) - FileViewer</h4>
+
+On Motif, drag and drop in File Viewer may cause the X-Server to hang. This is due to a thread synchronization issue in the example.
+This will be fixed in a future release of the FileViewer example.
+
+<h4>
+99.1.9 SWT Example (Standalone) - Hover Help</h4>
+
+On Motif, the tooltips may not appear correctly in all instances. This will be fixed in a future release.
+
+<h4>
+99.1.10 SWT Example (Workbench View) - Paint</h4>
+
+When the polygon tool is selected and the fill mode is set to Outline or Solid, the filled region may be rendered at the wrong location
+in the Canvas. This will be fixed in a future release of the Paint example.
+
+<p><a href="hglegal.htm"><img SRC="ngibmcpy.gif" BORDER=0 height=12 width=195></a>
+</body>
+</html>
diff --git a/bundles/org.eclipse.swt/ws/motif/libXm.so.2.1 b/bundles/org.eclipse.swt/ws/motif/libXm.so.2.1
new file mode 100755
index 0000000000..dc827a9744
--- /dev/null
+++ b/bundles/org.eclipse.swt/ws/motif/libXm.so.2.1
Binary files differ
diff --git a/bundles/org.eclipse.swt/ws/motif/libswt-gnome0125.so b/bundles/org.eclipse.swt/ws/motif/libswt-gnome0125.so
new file mode 100755
index 0000000000..3c3ba7ecda
--- /dev/null
+++ b/bundles/org.eclipse.swt/ws/motif/libswt-gnome0125.so
Binary files differ
diff --git a/bundles/org.eclipse.swt/ws/motif/libswt0125.so b/bundles/org.eclipse.swt/ws/motif/libswt0125.so
new file mode 100755
index 0000000000..c0972e72e4
--- /dev/null
+++ b/bundles/org.eclipse.swt/ws/motif/libswt0125.so
Binary files differ
diff --git a/bundles/org.eclipse.swt/ws/photon/libswt0125.so b/bundles/org.eclipse.swt/ws/photon/libswt0125.so
new file mode 100755
index 0000000000..81ca20bbea
--- /dev/null
+++ b/bundles/org.eclipse.swt/ws/photon/libswt0125.so
Binary files differ
diff --git a/bundles/org.eclipse.swt/ws/win32/swt0125.dll b/bundles/org.eclipse.swt/ws/win32/swt0125.dll
new file mode 100755
index 0000000000..90aab8fdff
--- /dev/null
+++ b/bundles/org.eclipse.swt/ws/win32/swt0125.dll
Binary files differ

Back to the top