boolean canDragRowsWithIndexes_atPoint(long /*int*/ id, long /*int*/ sel, long /*int*/ rowIndexes, NSPoint mouseDownPoint) { if (!super.canDragRowsWithIndexes_atPoint(id, sel, rowIndexes, mouseDownPoint)) return false; // If the current row is not selected and the user is not attempting to modify the selection, select the row first. NSTableView widget = (NSTableView)view; long /*int*/ row = widget.rowAtPoint(mouseDownPoint); long /*int*/ modifiers = NSApplication.sharedApplication().currentEvent().modifierFlags(); boolean drag = (state & DRAG_DETECT) != 0 && hooks (SWT.DragDetect); if (drag) { if (!widget.isRowSelected(row) && (modifiers & (OS.NSCommandKeyMask | OS.NSShiftKeyMask | OS.NSAlternateKeyMask | OS.NSControlKeyMask)) == 0) { NSIndexSet set = (NSIndexSet)new NSIndexSet().alloc(); set = set.initWithIndex(row); widget.selectRowIndexes (set, false); set.release(); } } // The clicked row must be selected to initiate a drag. return (widget.isRowSelected(row) && drag) || !hasFocus(); }
boolean canDragRowsWithIndexes_atPoint(long /*int*/ id, long /*int*/ sel, long /*int*/ rowIndexes, NSPoint mouseDownPoint) { if (!super.canDragRowsWithIndexes_atPoint(id, sel, rowIndexes, mouseDownPoint)) return false; // If the current row is not selected and the user is not attempting to modify the selection, select the row first. NSTableView widget = (NSTableView)view; long /*int*/ row = widget.rowAtPoint(mouseDownPoint); long /*int*/ modifiers = NSApplication.sharedApplication().currentEvent().modifierFlags(); boolean drag = (state & DRAG_DETECT) != 0 && hooks (SWT.DragDetect); if (drag) { if (!widget.isRowSelected(row) && (modifiers & (OS.NSCommandKeyMask | OS.NSShiftKeyMask | OS.NSAlternateKeyMask)) == 0) { NSIndexSet set = (NSIndexSet)new NSIndexSet().alloc(); set = set.initWithIndex(row); widget.selectRowIndexes (set, false); set.release(); } } // The clicked row must be selected to initiate a drag. return (widget.isRowSelected(row) && drag) || !hasFocus(); }