byte[] buffer = Converter.wcsToMbcs(null, "drag_data_get", true); OS.g_signal_connect(control.handle, buffer, DragGetData.getAddress(), 0); buffer = Converter.wcsToMbcs(null, "drag_end", true); OS.g_signal_connect(control.handle, buffer, DragEnd.getAddress(), 0); buffer = Converter.wcsToMbcs(null, "drag_data_delete", true); OS.g_signal_connect(control.handle, buffer, DragDataDelete.getAddress(), 0);
OS.g_signal_connect(control.handle, OS.drag_data_get, DragGetData.getAddress(), 0); OS.g_signal_connect(control.handle, OS.drag_end, DragEnd.getAddress(), 0); OS.g_signal_connect(control.handle, OS.drag_data_delete, DragDataDelete.getAddress(), 0);
public DragSource(Control control, int style) {	super (control, checkStyle(style));	this.control = control;	if (DragGetData == null || DragEnd == null || DragDataDelete == null) {		DND.error(DND.ERROR_CANNOT_INIT_DRAG);	}	if (control.getData(DRAGSOURCEID) != null) {		DND.error(DND.ERROR_CANNOT_INIT_DRAG);	}	control.setData(DRAGSOURCEID, this);	byte[] buffer = Converter.wcsToMbcs(null, "drag_data_get", true); //$NON-NLS-1$	OS.g_signal_connect(control.handle, buffer, DragGetData.getAddress(), 0);		buffer = Converter.wcsToMbcs(null, "drag_end", true); //$NON-NLS-1$	OS.g_signal_connect(control.handle, buffer, DragEnd.getAddress(), 0);	buffer = Converter.wcsToMbcs(null, "drag_data_delete", true); //$NON-NLS-1$	OS.g_signal_connect(control.handle, buffer, DragDataDelete.getAddress(), 0);		controlListener = new Listener () {		public void handleEvent (Event event) {			if (event.type == SWT.Dispose) {				if (!DragSource.this.isDisposed()) {					DragSource.this.dispose();				}			}			if (event.type == SWT.DragDetect) {				if (!DragSource.this.isDisposed()) {					DragSource.this.drag(event);				}			}		}	};	control.addListener (SWT.Dispose, controlListener);	control.addListener (SWT.DragDetect, controlListener);		this.addListener(SWT.Dispose, new Listener() {		public void handleEvent(Event e) {			onDispose();		}	});}