public int Begin(NSIndexSet aIndices, object aSource, NSPasteboard aPasteboard) { // build list of indices to be dragged List <int> indices = new List <int>(); uint index = aIndices.FirstIndex; while (index != FoundationFramework.NSNotFound) { indices.Add((int)index); index = aIndices.IndexGreaterThanIndex(index); } // set the current data to be dragged DragDropManager.Current = iController.DragBegin(indices, aSource); // add a token to the pasteboard PasteboardViewDragData token = new PasteboardViewDragData(); NSData tokenData = NSKeyedArchiver.ArchivedDataWithRootObject(token); token.Release(); aPasteboard.DeclareTypesOwner(NSArray.ArrayWithObject(PasteboardViewDragData.PboardType), null); aPasteboard.SetDataForType(tokenData, PasteboardViewDragData.PboardType); return(indices.Count); }
public bool TableViewWriteToPasteboard(NSTableView aTableView, NSIndexSet aRows, NSPasteboard aPasteboard) { Console.WriteLine("TableViewWriteToPasteboard::" + aRows.Count); iDraggedBookmarks = new List <Bookmark>(); uint index = aRows.FirstIndex; while (index != FoundationFramework.NSNotFound) { iDraggedBookmarks.Add(iBookmarks[(int)index].CastAs <BookmarkData>().Bookmark); index = aRows.IndexGreaterThanIndex(index); } // add a token to the pasteboard PasteboardViewDragDataBookmarks token = new PasteboardViewDragDataBookmarks(); NSData tokenData = NSKeyedArchiver.ArchivedDataWithRootObject(token); token.Release(); aPasteboard.DeclareTypesOwner(NSArray.ArrayWithObject(PasteboardViewDragDataBookmarks.PboardType), null); aPasteboard.SetDataForType(tokenData, PasteboardViewDragDataBookmarks.PboardType); iDragging = true; return(true); }