Пример #1
0
            GridViewDragInfo GetDragInfo(NSDraggingInfo info, nint row, NSTableViewDropOperation dropOperation)
            {
                var h         = Handler;
                var tableView = h.Control;
                var position  = GridDragPosition.Over;

                if (dropOperation == NSTableViewDropOperation.On)
                {
                    position = GridDragPosition.Over;
                }
                else
                {
                    // need to check if it's actually above or below the item under the cursor
                    var rowUnderMouse = tableView.GetRow(tableView.ConvertPointFromView(info.DraggingLocation, null));
                    if (row == rowUnderMouse)
                    {
                        position = GridDragPosition.Before;
                    }
                    else
                    {
                        position = GridDragPosition.After;
                        if (row > 0)
                        {
                            row--;
                        }
                    }
                }
                var item = row >= 0 ? h.GetItem((int)row) : null;

                return(new GridViewDragInfo(h.Widget, item, (int)row, position));
            }
 public override NSDragOperation ValidateDrop(NSTableView tableView, NSDraggingInfo info, nint row, NSTableViewDropOperation dropOperation)
 {
     if (_openSubtitleAction != null)
     {
         return NSDragOperation.Copy;
     }
     return NSDragOperation.None;
 }
 public override bool AcceptDrop(NSTableView tableView, NSDraggingInfo info, nint row, NSTableViewDropOperation dropOperation)
 {
     NSPasteboard pboard = info.DraggingPasteboard;
     NSArray files = (NSArray)pboard.GetPropertyListForType(NSPasteboard.NSFilenamesType);
     if (files.Count == 1)
     {
         return true;
     }
     return false;
 }
            public override NSDragOperation ValidateDrop(NSTableView tableView, NSDraggingInfo info, nint row, NSTableViewDropOperation dropOperation)
            {
                if (info.DraggingPasteboard.GetDataForType(DataTypeName) != null)
                {
                    return(NSDragOperation.Move);
                }

                return(NSDragOperation.None);
            }
Пример #5
0
        public override bool AcceptDrop(NSTableView tableView, NSDraggingInfo info, nint row, NSTableViewDropOperation dropOperation)
        {
            NSData rowData = info.DraggingPasteboard.GetDataForType(DungeonToolsConstants.ECOUNTER_INITIATIVE_DRAG_DROP_TYPE);

            if (rowData == null)
            {
                return(false);
            }
            NSIndexSet dataArray = NSKeyedUnarchiver.UnarchiveObject(rowData) as NSIndexSet;

            tableView.BeginUpdates();
            SwapCreatures(dataArray, (int)row);
            tableView.ReloadData();
            tableView.EndUpdates();
            return(true);
        }
 public NSDragOperation TableViewValidateDropProposedRowProposedDropOperation(NSTableView aTableView, INSDraggingInfo info, int row, NSTableViewDropOperation operation)
 {
     throw new NotImplementedException();
 }
Пример #7
0
 public override NSDragOperation ValidateDrop(NSTableView tableView, NSDraggingInfo info, nint row, NSTableViewDropOperation dropOperation)
 {
     return(NSDragOperation.None);
 }
Пример #8
0
 public NSDragOperation TableViewValidateDropProposedRowProposedDropOperation(NSTableView aTableView, INSDraggingInfo info, int row, NSTableViewDropOperation operation)
 {
     throw new NotImplementedException ();
 }
 public override bool AcceptDrop(NSTableView tableView, NSDraggingInfo info, int row, NSTableViewDropOperation dropOperation)
 {
     if (AcceptDropFunc != null)
     {
         return(AcceptDropFunc(tableView, info, row, dropOperation));
     }
     return(default(bool));
 }
 public override NSDragOperation ValidateDrop(NSTableView tableView, NSDraggingInfo info, int row, NSTableViewDropOperation dropOperation)
 {
     if (ValidateDropFunc != null)
     {
         return(ValidateDropFunc(tableView, info, row, dropOperation));
     }
     return(default(NSDragOperation));
 }
Пример #11
0
        public override bool AcceptDrop(NSTableView tableView, NSDraggingInfo info, nint row, NSTableViewDropOperation dropOperation)
        {
            if (row < 0)
            {
                return(false);
            }

            NSPasteboard pboard     = info.DraggingPasteboard;
            NSData       rowData    = pboard.GetDataForType("NSStringPboardType");     //NSStringPboardType
            var          rowIndexes = NSKeyedUnarchiver.UnarchiveObject(rowData);
            int          dragRow    = (int)((NSIndexSet)rowIndexes).FirstIndex;

            if (dragRow == row)
            {
                return(false);
            }

            int index = Convert.ToInt32(row);

            if (dropOperation == NSTableViewDropOperation.Above)
            {
                // 插入
                panelController.DragItemFromIndexToIndex(tableView, dragRow, index);
                tableView.ReloadData();
            }
            else if (dropOperation == NSTableViewDropOperation.On)
            {
                // 替换
            }
            else
            {
                //Console.WriteLine ("unexpected operation {0} in {1}", dropOperation, __FUNCTION__);
            }

            return(true);
        }
Пример #12
0
 /// <inheritdoc/>
 public override NSDragOperation ValidateDrop(NSTableView tableView, NSDraggingInfo info, nint row, NSTableViewDropOperation dropOperation)
 {
     DebugDragDrop("***** UPDATE VALIDATE DROP");
     return(NSDragOperation.Link);
 }
Пример #13
0
        public NSDragOperation ValidateDropForRow(NSTableView tableView, NSDraggingInfo info, int row, NSTableViewDropOperation operation)
        {
            Console.WriteLine(">>> ValidateDropForRow - row: {0} operation: {1}", row, operation);
            if (info.DraggingSource == tableSegments)
            {
                // Do not allow dragging on segments, only allow reordering of rows
                return operation == NSTableViewDropOperation.Above ? NSDragOperation.All : NSDragOperation.None;
            }
            else if (info.DraggingSource == tableMarkers)
            {
                // Allow dragging on segments to link an existing segment to a marker
                // Allow dragging above segments to create a new segment from a marke
                return NSDragOperation.All;
            }

            return NSDragOperation.None;
        }
Пример #14
0
        public bool AcceptDropForRow(NSTableView tableView, NSDraggingInfo info, int row, NSTableViewDropOperation operation)
        {
            NSData data = null;
            string dataType = string.Empty;
            if (info.DraggingSource == tableSegments)
                dataType = "Segment";
            else if (info.DraggingSource == tableMarkers)
                dataType = "Marker";

            data = info.DraggingPasteboard.GetDataForType(dataType);
            byte[] dataBytes = data.ToArray();
            byte originRow = dataBytes[0];

            Console.WriteLine(">>> AcceptDropForRow - originRow: {0} newRow: {1}", originRow, row);
            if (operation == NSTableViewDropOperation.Above)
            {
                if (info.DraggingSource == tableSegments)
                    OnChangeSegmentOrder(_currentLoop.Segments[originRow], row);
                else if (info.DraggingSource == tableMarkers)
                    OnAddSegmentFromMarker(_markers[originRow].MarkerId, row);
            }
            else if (operation == NSTableViewDropOperation.On)
            {
                if (info.DraggingSource == tableMarkers)
                    OnLinkSegmentToMarker(_currentLoop.Segments[row], _markers[originRow].MarkerId);
            }

            return true;
        }
            public override bool AcceptDrop(NSTableView tableView, NSDraggingInfo info, nint row, NSTableViewDropOperation dropOperation)
            {
                NSData     data    = info.DraggingPasteboard.GetDataForType(DataTypeName);
                NSIndexSet indexes = NSKeyedUnarchiver.UnarchiveObject(data) as NSIndexSet;

                if (indexes == null)
                {
                    return(false);
                }

                // Dropping at the bottom gives a row at the count, but we shift indexes first
                if (row >= this.viewModel.Targets.Count)
                {
                    row = this.viewModel.Targets.Count - 1;
                }

                this.viewModel.MoveTarget((int)indexes.FirstIndex, (int)row);
                return(true);
            }
Пример #16
0
        public override bool AcceptDrop(NSTableView tableView, NSDraggingInfo info, nint row, NSTableViewDropOperation dropOperation)
        {
            NSPasteboard pboard = info.DraggingPasteboard;
            NSArray      files  = (NSArray)pboard.GetPropertyListForType(NSPasteboard.NSFilenamesType);

            if (files.Count == 1)
            {
                return(true);
            }
            return(false);
        }
Пример #17
0
 public override NSDragOperation ValidateDrop(NSTableView tableView, NSDraggingInfo info, nint row, NSTableViewDropOperation dropOperation)
 {
     if (_openSubtitleAction != null)
     {
         return(NSDragOperation.Copy);
     }
     return(NSDragOperation.None);
 }
Пример #18
0
 public bool TableViewAcceptDropRowDropOperation(NSTableView aTableView, INSDraggingInfo info, int row, NSTableViewDropOperation operation)
 {
     return false;
 }
Пример #19
0
 public NSDragOperation TableViewValidateDrop(NSTableView aTableView, INSDraggingInfo aInfo, int aRow, NSTableViewDropOperation aOperation)
 {
     if (aTableView == ViewTable)
     {
         return(NSDragOperation.NSDragOperationMove);
     }
     return(NSDragOperation.NSDragOperationNone);
 }
Пример #20
0
 public override bool AcceptDrop(NSTableView tableView, NSDraggingInfo info, nint row, NSTableViewDropOperation dropOperation)
 {
     return(false);
 }
Пример #21
0
 public bool TableViewAcceptDrop(NSTableView aTableView, INSDraggingInfo aInfo, int aRow, NSTableViewDropOperation aOperation)
 {
     if (aTableView == ViewTable)
     {
         UserLog.WriteLine("Moving " + iDraggedBookmarks.Count + " bookmark(s) to index " + aRow);
         iBookmarkManager.Move(aRow, iDraggedBookmarks);
         return(true);
     }
     return(false);
 }
Пример #22
0
            public override NSDragOperation ValidateDrop(NSTableView tableView, NSDraggingInfo info, nint row, NSTableViewDropOperation dropOperation)
            {
                var h = Handler;

                if (h == null)
                {
                    return(NSDragOperation.None);
                }
                var etoInfo = GetDragInfo(info, row, dropOperation);
                var e       = h.GetDragEventArgs(info, etoInfo);

                h.Callback.OnDragOver(h.Widget, e);
                if (e.AllowedEffects.HasFlag(e.Effects))
                {
                    var idx = etoInfo.Index;
                    if (idx >= 0)
                    {
                        var pos = etoInfo.Position;
                        if (pos == GridDragPosition.After)
                        {
                            pos = GridDragPosition.Before;
                            idx++;
                        }
                        tableView.SetDropRowDropOperation((nint)idx, pos == GridDragPosition.Over ? NSTableViewDropOperation.On : NSTableViewDropOperation.Above);
                    }
                    else
                    {
                        tableView.SetDropRowDropOperation(-1, NSTableViewDropOperation.On);
                    }

                    return(e.Effects.ToNS());
                }
                else
                {
                    return(NSDragOperation.None);
                }
            }
Пример #23
0
 public override NSDragOperation ValidateDrop(NSTableView tableView, NSDraggingInfo info, nint row, NSTableViewDropOperation dropOperation)
 {
     tableView.SetDropRowDropOperation(row, dropOperation);
     return(NSDragOperation.Move);
 }
Пример #24
0
            public override bool AcceptDrop(NSTableView tableView, NSDraggingInfo info, nint row, NSTableViewDropOperation dropOperation)
            {
                var h = Handler;

                if (h == null)
                {
                    return(false);
                }
                var e = h.GetDragEventArgs(info, GetDragInfo(info, row, dropOperation));

                h.Callback.OnDragLeave(h.Widget, e);
                h.Callback.OnDragDrop(h.Widget, e);
                return(true);
            }
 public bool TableViewAcceptDropRowDropOperation(NSTableView aTableView, INSDraggingInfo info, int row, NSTableViewDropOperation operation)
 {
     return(false);
 }