Example #1
0
            public DragEventSource(long pointerId, NSDraggingInfo draggingInfo, NSWindow window)
            {
                Id = pointerId;

                _macOSDraggingInfo = draggingInfo;
                _window            = window;
            }
Example #2
0
        static bool PerformDragOperation(IntPtr sender, IntPtr sel, IntPtr dragInfo)
        {
            IViewObject <T> ob = Runtime.GetNSObject(sender) as IViewObject <T>;

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

            var backend = (ViewBackend <T, S>)WidgetRegistry.GetBackend(ob.Frontend);

            NSDraggingInfo di  = new NSDraggingInfo(dragInfo);
            var            pos = new Point(di.DraggingLocation.X, di.DraggingLocation.Y);

            if ((backend.currentEvents & WidgetEvent.DragDrop) != 0)
            {
                TransferDataStore store = new TransferDataStore();
                FillDataStore(store, di.DraggingPasteboard, ob.View.RegisteredDragTypes());
                var args = new DragEventArgs(pos, store, ConvertAction(di.DraggingSourceOperationMask));
                backend.eventSink.OnDragDrop(args);
                return(args.Success);
            }
            else
            {
                return(false);
            }
        }
Example #3
0
        public override bool PerformDragOperation(NSDraggingInfo sender)
        {
            NSPasteboard pb = sender.DraggingPasteboard;

            foreach (var x in pb.PasteboardItems)
            {
                Console.WriteLine("x => {0}", x.Types);
                foreach (var y in x.Types)
                {
                    Console.WriteLine("{0} => {1}", y, pb.GetStringForType(y));
                }
            }

            var file = pb.GetStringForType("public.file-url");

            if (!string.IsNullOrEmpty(file))
            {
                if (dropped != null)
                {
                    file = HttpUtility.UrlDecode(file);
                    dropped.Invoke(file);
                }

                return(true);
            }

            Console.WriteLine("Got no string");
            return(false);
        }
Example #4
0
        public override bool AcceptDrop(NSTableView tableView, NSDraggingInfo info, int row, NSTableViewDropOperation dropOperation)
        {
            NSPasteboard pboard = info.DraggingPasteboard;
            NSArray      files  = (NSArray)pboard.GetPropertyListForType(NSPasteboard.NSFilenamesType);

            return(true);
        }
Example #5
0
        public override bool PerformDragOperation(NSDraggingInfo sender)
        {
            NSPasteboard pb = sender.DraggingPasteboard;
            NSArray data = null;

            if (pb.Types.Contains(NSPasteboard.NSFilenamesType))
                data = pb.GetPropertyListForType(NSPasteboard.NSFilenamesType) as NSArray;

            if (data != null && IsDroppable == true)
            {
                WorkFiles = new WorkFile[(int)data.Count];
                for (int i = 0; i < (int)data.Count; i++)
                {
                    // make workfile array from pasteboard
                    string tempString = (string)NSString.FromHandle(data.ValueAt((uint)i));
                    NSUrl tempNSUrl = NSUrl.FromFilename(tempString);

                    WorkFiles[i] = new WorkFile();
                    WorkFiles[i].Init(tempNSUrl);
                    Console.WriteLine("Loaded file: {0}", WorkFiles[i].fileName);
                }
                CreateWorkManager();
            }
            return true;
        }
Example #6
0
            public override NSDragOperation ValidateDrop(NSOutlineView outlineView, NSDraggingInfo info, NSObject item, nint index)
            {
                var h = Handler;

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

                h.Callback.OnDragOver(h.Widget, e);
                if (e.AllowedEffects.HasFlag(e.Effects))
                {
                    if (etoInfo.Position == GridDragPosition.Over)
                    {
                        outlineView.SetDropItem(h.GetCachedItem(etoInfo.Item), -1);
                    }
                    else
                    {
                        outlineView.SetDropItem(h.GetCachedItem(etoInfo.Parent), etoInfo.InsertIndex);
                    }

                    return(e.Effects.ToNS());
                }
                else
                {
                    return(NSDragOperation.None);
                }
            }
Example #7
0
        public override bool PerformDragOperation(NSDraggingInfo sender)
        {
            NSPasteboard pb = sender.DraggingPasteboard;
            NSArray data = null;

            if (pb.Types.Contains(NSPasteboard.NSFilenamesType)) {
                data = pb.GetPropertyListForType(NSPasteboard.NSFilenamesType) as NSArray;
            }

            if (data != null) {

                for (nuint i = 0; i < data.Count; i++) {

                    var url = data.ValueAt(i).ToFileUrl();

                    if (url.IsFileUrl && File.Exists(url.Path)) {

                        if (url.Path.HasNibExtension()) {

                            url.Path.AddXtcIdsToiOS();

                        } else if (url.Path.HasAndroidExtension()) {

                            url.Path.AddXtcIdsToAndroid();

                        } else {

                            throw new NotSupportedException ("File extension must be .storyboard, .xib, or .axml");
                        }
                    }
                }
            }

            return true;
        }
Example #8
0
		public override bool PerformDragOperation (NSDraggingInfo sender)
		{
			Console.WriteLine ("Drag Delegate received 'PerformDragOperation' sender: {0}", sender);

			//It seems that browserView does not send this message when it is an internal move.
			//It does all the work by sending a moveitems message to the datasource,
			// but I return false here just to be safe.

			NSObject obj = sender.DraggingSource;
			if (obj != null && obj.Equals (browserView)) {
				Console.WriteLine ("\tLet the image browser handle it.");
				return false;
			}

			NSPasteboard pb = sender.DraggingPasteboard ;
			NSArray data = null;
			//			if (pb.Types.Contains (NSPasteboard.NSUrlType))
			//				data = pb.GetPropertyListForType (NSPasteboard.NSUrlType) as NSArray;
			if (pb.Types.Contains (NSPasteboard.NSFilenamesType))
				data = pb.GetPropertyListForType (NSPasteboard.NSFilenamesType) as NSArray;
			if (data != null) {
				for (int i = 0; i < (int) data.Count; i++) {
					string path = (string)NSString.FromHandle (data.ValueAt ((uint)i));
					Console.WriteLine ("From pasteboard Item {0} = {1}", i, path);
					((BrowseData)browserView.DataSource).AddImages (
						NSUrl.FromFilename (path), (int)browserView.GetIndexAtLocationOfDroppedItem ());
					browserView.ReloadData ();
				}
			}
			return true;
		}
Example #9
0
        public override NSDragOperation DraggingEntered(NSDraggingInfo sender)
        {
            var pasteboard = sender.DraggingPasteboard;

            if (pasteboard.Types.Contains(NSPasteboard.NSFilenamesType))
            {
                var filenames = pasteboard.GetPropertyListForType(NSPasteboard.NSFilenamesType) as NSArray;
                if (filenames != null)
                {
                    _firstPageController = Superview as UView;
                    if (_firstPageController != null)
                    {
                        _list.Clear();
                        for (uint i = 0; i < filenames.Count; i++)
                        {
                            _list.Add((string)NSString.FromHandle(filenames.ValueAt(i)));
                        }
                        if (_firstPageController.Controller.CanDropFiles(_list))
                        {
                            _dragOperation = NSDragOperation.Copy;
                            return(NSDragOperation.Copy);
                        }
                    }
                }
            }
            _dragOperation = NSDragOperation.None;
            return(NSDragOperation.None);
        }
Example #10
0
        DragEventArgs ToDragEventArgs(NSDraggingInfo sender, DragDropEffects effect = UnusedDndEffect)
        {
            var q         = ToMonoScreen(sender.DraggingLocation, null);
            var allowed   = XplatUICocoa.DraggingAllowedEffects;
            var modifiers = NSEvent.CurrentModifierFlags;

            // translate mac modifiers to win modifiers
            // 1(bit 0)  - The left mouse button.
            // 2(bit 1)  - The right mouse button.
            // 4(bit 2)  - The SHIFT key.
            // 8(bit 3)  - The CTRL key.
            // 16(bit 4) - The middle mouse button.
            // 32(bit 5) - The ALT key.

            int keystate = 0;

            if (0 != (modifiers & NSEventModifierMask.ShiftKeyMask))
            {
                keystate |= 4;
            }
            if (0 != (modifiers & NSEventModifierMask.AlternateKeyMask))             // alt (mac) => ctrl (win)
            {
                keystate |= 8;
            }

            var idata = XplatUICocoa.DraggedData as IDataObject ?? (IDataObject)(XplatUICocoa.DraggedData = ToIDataObject(sender.DraggingPasteboard));

            return(new DragEventArgs(idata, keystate, q.X, q.Y, allowed, effect));
        }
Example #11
0
        public override bool PerformDragOperation(NSDraggingInfo dragInfo)
        {
            if (CompleteDropAction == null)
            {
                return false;
            }

            // Convert point to be relative to the map from window coordinates. Invert Y because the mapping
            // library is expecting 0 to be at the top, not the bottom
            var pt = ConvertPointFromView(new PointF(dragInfo.DraggingLocation.X, dragInfo.DraggingLocation.Y), null);
            pt.Y = Frame.Height - pt.Y;
            var ret = InvokeMapScript("pointToLatLng([{0}, {1}])", pt.X, pt.Y) as NSString;
            if (ret != null)
            {
                var json = JObject.Parse((string) ret);
                var lat = (double) json["lat"];
                var lng = (double) json["lng"];

                CompleteDropAction(lat, lng, FilePaths(dragInfo));
                return true;
            }

            logger.Error("pointToLatLng returned unexpected value: {0}", ret);
            return false;
        }
Example #12
0
        static bool PrepareForDragOperation(IntPtr sender, IntPtr sel, IntPtr dragInfo)
        {
            IViewObject <T> ob = Runtime.GetNSObject(sender) as IViewObject <T>;

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

            var backend = (ViewBackend <T, S>)WidgetRegistry.GetBackend(ob.Frontend);

            NSDraggingInfo di    = new NSDraggingInfo(dragInfo);
            var            types = di.DraggingPasteboard.Types.Select(t => ToXwtDragType(t)).ToArray();
            var            pos   = new Point(di.DraggingLocation.X, di.DraggingLocation.Y);

            if ((backend.currentEvents & WidgetEvent.DragDropCheck) != 0)
            {
                var args = new DragCheckEventArgs(pos, types, ConvertAction(di.DraggingSourceOperationMask));
                backend.eventSink.OnDragDropCheck(args);
                if (args.Result == DragDropResult.Canceled)
                {
                    return(false);
                }
            }
            return(true);
        }
 public override void UpdateDraggingItems(NSTableView tableView, NSDraggingInfo draggingInfo)
 {
     if (UpdateDraggingItemsAction != null)
     {
         UpdateDraggingItemsAction(tableView, draggingInfo);
     }
 }
 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));
 }
 public override NSDragOperation ValidateDrop(NSTableView tableView, NSDraggingInfo info, nint row, NSTableViewDropOperation dropOperation)
 {
     if (_openSubtitleAction != null)
     {
         return NSDragOperation.Copy;
     }
     return NSDragOperation.None;
 }
Example #17
0
 NSDragOperation DraggingEntered(NSDraggingInfo info)
 {
     if (owner.DraggingEntered(info))
     {
         return(NSDragOperation.Copy);
     }
     return(NSDragOperation.None);
 }
Example #18
0
 public override NSDragOperation DraggingUpdated(NSDraggingInfo sender)
 {
     if (CompleteDropAction == null)
     {
         return NSDragOperation.None;
     }
     return NSDragOperation.Copy;
 }
Example #19
0
 public override NSDragOperation ValidateDrop(NSTableView tableView, NSDraggingInfo info, nint row, NSTableViewDropOperation dropOperation)
 {
     if (_openSubtitleAction != null)
     {
         return(NSDragOperation.Copy);
     }
     return(NSDragOperation.None);
 }
Example #20
0
 public override NSDragOperation DraggingEntered(NSDraggingInfo sender)
 {
     if (sender.DraggingPasteboard.Types.Any(t => t == NSPasteboard.NSFilenamesType.ToString()))
     {
         return(NSDragOperation.Copy);
     }
     return(NSDragOperation.None);
 }
            public override NSDragOperation ValidateDrop(NSTableView tableView, NSDraggingInfo info, nint row, NSTableViewDropOperation dropOperation)
            {
                if (info.DraggingPasteboard.GetDataForType(DataTypeName) != null)
                {
                    return(NSDragOperation.Move);
                }

                return(NSDragOperation.None);
            }
Example #22
0
 public override NSDragOperation DraggingUpdated(NSDraggingInfo sender)
 {
     NSObject obj = sender.DraggingSource;
     if (obj != null && obj.Equals(Self))
     {
         return NSDragOperation.Move;
     }
     return NSDragOperation.Copy;
 }
Example #23
0
        public override NSDragOperation DraggingEntered(NSDraggingInfo sender)
        {
            if (AcceptDragSource(sender))
            {
                return(NSDragOperation.Generic);
            }

            return(NSDragOperation.None);
        }
Example #24
0
 public override NSDragOperation DraggingEntered(NSDraggingInfo dragInfo)
 {
     if (CompleteDropAction == null)
     {
         return NSDragOperation.None;
     }
     var list = FilePaths(dragInfo);
     return list.Count > 0 ? NSDragOperation.Copy : NSDragOperation.None;
 }
Example #25
0
        public override NSDragOperation DraggingEntered(NSDraggingInfo sender)
        {
            if (IsCSharpFilePathUrl(GetFilePathUrl(sender)))
            {
                return(NSDragOperation.Copy);
            }

            return(NSDragOperation.None);
        }
Example #26
0
        DragEventArgs ToDragEventArgs(NSDraggingInfo sender, DragDropEffects effect = UnusedDndEffect)
        {
            var q         = ToMonoScreen(sender.DraggingLocation, null);
            var allowed   = XplatUICocoa.DraggingAllowedEffects;
            var modifiers = NSEvent.CurrentModifierFlags.ToKeys();
            var idata     = XplatUICocoa.DraggedData as IDataObject ?? (IDataObject)(XplatUICocoa.DraggedData = ToIDataObject(sender.DraggingPasteboard));

            return(new DragEventArgs(idata, (int)modifiers, q.X, q.Y, allowed, effect));
        }
Example #27
0
 public override NSDragOperation ValidateDrop(NSTableView tableView, NSDraggingInfo info, nint row, NSTableViewDropOperation dropOperation)
 {
     tableView.SetDropRowDropOperation(row, dropOperation);
     if (dropOperation == NSTableViewDropOperation.On)
     {
         return(NSDragOperation.None);
     }
     return(NSDragOperation.Move);
 }
            /// <inheritdoc />
            public override bool AcceptDrop(NSOutlineView outlineView, NSDraggingInfo info, NSObject item, nint index)
            {
                DebugDragDropPrint("***** OutlineView.AcceptDrop, index: " + index);
                var  dropLocationTreeNode = item as NSTreeNode;
                bool acceptedDrop         = dropLocationTreeNode != null;
                var  viewModel            = outlineView.GetInheritedValue <MenuLayoutViewModel>(IFakeDependencyObjectHelpers.DataContextPropertyName);
                IEnumerable <FileNodeViewModel> draggedItems = null;

                if (acceptedDrop)
                {
                    var newParent  = dropLocationTreeNode.GetRepresentedObject() as FolderViewModel;
                    var pasteboard = info.DraggingPasteboard;
                    acceptedDrop = newParent != null;
                    if (acceptedDrop && pasteboard.CanReadItemWithDataConformingToTypes(MenuLayoutPasteboardDataTypeArray))
                    {
                        draggedItems = DragDropHelpers.GetDataForType <IEnumerable <FileNodeViewModel> >(pasteboard, MenuLayoutPasteboardDataTypeArray);
                        if (acceptedDrop)
                        {
                            acceptedDrop = newParent.ShouldAcceptDraggedItems(draggedItems.Select(draggedItem => draggedItem.Model));
                        }
                        if (acceptedDrop)
                        {
                            var firstDraggedItem = draggedItems.First();
                            var parent           = firstDraggedItem.Parent;
                            var parentViewModel  = viewModel.FindViewModelForModel(parent);
                            if (parentViewModel == newParent)
                            {
                                var currentIndex = parent.IndexOfChild(firstDraggedItem.Model);
                                if (currentIndex < index)
                                {
                                    --index;
                                }
                            }
                            acceptedDrop = newParent.MoveItems(viewModel, newParent, (int)index, draggedItems);
                        }
                    }
                    else if (acceptedDrop && pasteboard.CanReadItemWithDataConformingToTypes(ProgramDescriptionPasteboardDataTypeArray))
                    {
                        var droppedItems = DragDropHelpers.GetDataForType <IEnumerable <ProgramDescriptionViewModel> >(pasteboard, ProgramDescriptionPasteboardDataTypeArray).Select(draggedItem => draggedItem.Model);
                        newParent.AddItems(viewModel, (int)index, droppedItems);
                    }
                    else
                    {
                        acceptedDrop = false;
                    }
                    DebugDragDropPrint("*** OutlineView drop into: " + newParent);
                }
                if (acceptedDrop)
                {
                    TreeData.RearrangeObjects();
                    if ((draggedItems != null) && draggedItems.Any())
                    {
                        viewModel.CurrentSelection = draggedItems.FirstOrDefault(i => i.Model != null);
                    }
                }
                return(acceptedDrop);
            }
Example #29
0
        /// <summary>
        /// Gets the drag enter effects.
        /// </summary>
        /// <param name="dragArgs">Drag information used to determine drag-drop effects.</param>
        /// <returns>The drag-drop effects to apply when a drag operation enters the ROM list.</returns>
        internal NSDragOperation GetDragEnterEffects(NSDraggingInfo dragArgs)
        {
            var effects = NSDragOperation.None;

            if (dragArgs.DraggingPasteboard.CanReadItemWithDataConformingToTypes(new string[] { DragDropFilesDataFormat }) && !dragArgs.DraggingPasteboard.CanReadItemWithDataConformingToTypes(new string[] { ProgramDescriptionViewModel.DragDataFormat }))
            {
                effects = NSDragOperation.Link;
            }
            return(effects);
        }
Example #30
0
        public override NSDragOperation DraggingUpdated(NSDraggingInfo sender)
        {
            NSDragOperation op = sender.DraggingSourceOperationMask;

            if (sender.DraggingSource == this)
            {
                return(NSDragOperation.None);
            }
            return(NSDragOperation.Copy);
        }
Example #31
0
		bool PerformDragOperation(NSDraggingInfo sender)
		{
			if (DropAction != null)
			{
				var list = FilePaths(sender);
				DropAction(list);
				return true;
			}
			return false;
		}
Example #32
0
        public override void DraggingExited(NSDraggingInfo sender)
        {
            var control = Control.FromHandle(Handle);

            if (null != control && control.AllowDrop)
            {
                var e = ToDragEventArgs(sender);
                control.DndLeave(e);
            }
        }
 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;
 }
Example #34
0
        public override NSDragOperation DraggingEntered(NSDraggingInfo sender)
        {
            if (sender.DraggingSource == this)
            {
                return(NSDragOperation.None);
            }
            Highlighted  = true;
            NeedsDisplay = true;

            return(NSDragOperation.Copy);
        }
Example #35
0
 public override NSDragOperation DraggingEntered(NSDraggingInfo sender)
 {
     if (sender.DraggingPasteboard.Types.Contains("ObjectName"))
     {
         return(NSDragOperation.Generic);
     }
     else
     {
         return(NSDragOperation.None);
     }
 }
Example #36
0
 [Export("draggingUpdated:")]         // Do not remove
 internal virtual NSDragOperation DraggingUpdated(NSDraggingInfo draggingInfo)
 {
     try
     {
         return(DraggingUpdatedAction.Invoke(draggingInfo));
     }
     catch
     {
         return(NSDragOperation.None);
     }
 }
Example #37
0
 [Export("performDragOperation:")]         // Do not remove
 internal virtual bool PerformDragOperation(NSDraggingInfo draggingInfo)
 {
     try
     {
         return(PerformDragOperationAction.Invoke(draggingInfo));
     }
     catch
     {
         return(false);
     }
 }
        public override NSDragOperation DraggingUpdated(NSDraggingInfo sender)
        {
            base.DraggingUpdated(sender);

            if (sender.DraggingLocation.X < LeftMargin)
            {
                SetPositionOfDivider(LeftMargin, 0);
            }
            Console.WriteLine(sender.DraggingLocation.X);

            return(NSDragOperation.Move);
        }
Example #39
0
 public override bool PerformDragOperation(NSDraggingInfo sender)
 {
     NSApplication.SharedApplication.ActivateIgnoringOtherApps(true);
     Window.MakeKeyAndOrderFront(sender);
     NSApplication.SharedApplication.ActivateIgnoringOtherApps(false);
     if (_dragOperation == NSDragOperation.Copy)
     {
         _firstPageController.Controller.DropFiles(_list);
         return(true);
     }
     return(false);
 }
Example #40
0
		public override void DraggingEnded (NSDraggingInfo sender)
		{
			// Update the dropped item counter and display
			dragCount++;
			UpdateDragCount ();

			// Pull the individual items from the drag package and write them to the console
			var i = new NSImage (sender.DraggingPasteboard.GetDataForType (NSPasteboard.NSTiffType));
			string s = NSString.FromData (sender.DraggingPasteboard.GetDataForType (NSPasteboard.NSStringType), NSStringEncoding.UTF8);
			Console.WriteLine ("String Data: {0}", s);
			Console.WriteLine ("Image Data: {0}", i.Size);
		}
Example #41
0
        [Export("draggingExited:")]         // Do not remove
        internal virtual void DraggingExited(NSDraggingInfo draggingInfo)
        {
            try
            {
                DraggingExitedAction.Invoke(draggingInfo);
            }
            catch
            {
                // Simply return if an error occurred, it is unrecoverable
            }

            return;
        }
Example #42
0
		public override NSDragOperation DraggingUpdated (NSDraggingInfo sender)
		{
			//The ImageBrowserView uses this method to set the icon during dragging. Regardless
			//of what we return the view will send a moveitems message to the datasource.
			//so it is best to not display the copy icon.

			//Console.WriteLine ("Drag Delegate received 'DraggingUpdated'");
			NSObject obj = sender.DraggingSource;
			if (obj != null && obj.Equals (browserView))
			{
				return NSDragOperation.Move;
			}
			return NSDragOperation.Copy;
		}
 public override void UpdateDraggingItems(NSTableView tableView, NSDraggingInfo draggingInfo)
 {
     if (_openSubtitleAction == null)
     {
         return;
     }
         
     NSPasteboard pboard = draggingInfo.DraggingPasteboard;
     NSArray files = (NSArray)pboard.GetPropertyListForType(NSPasteboard.NSFilenamesType);
     if (files.Count == 1)
     {
         _openSubtitleAction.OpenSubtitlePromptForChanges((string)files.GetItem<NSString>(0), false);
     }
 }       
 public override bool PerformDragOperation(NSDraggingInfo sender)
 {
     var item = sender.DraggingPasteboard.PasteboardItems.First();
     if (item.Types.Any(x => x == "public.url"))
     {
         var url = new NSString(item.GetStringForType("public.url"));
         ImageUrlDropped?.Invoke(this, new DropEventArgs(url));
     }
     else if (item.Types.Any(x => x == "public.file-url"))
     {
         var url = new NSString(new NSUrl(item.GetStringForType("public.file-url")).Path);
         FileDropped?.Invoke(this, new DropEventArgs(url));
     }
     else
     {
         return false;
     }
     return true;
 }
        public override NSDragOperation DraggingEntered(NSDraggingInfo sender)
        {
            var item = sender.DraggingPasteboard.PasteboardItems.First();

            NSString url;
            if (item.Types.Any(x => x == "public.url"))
            {
                url = new NSString(item.GetStringForType("public.url"));
            }
            else if (item.Types.Any(x => x == "public.file-url"))
            {
                url = new NSString(new NSUrl(item.GetStringForType("public.file-url")).Path);
            }
            else {
                return NSDragOperation.None;
            }
            return CanConformsToImageUTI(url)
                             ? NSDragOperation.Copy
                                 : NSDragOperation.None;
        }
Example #46
0
		IList<string> FilePaths(NSDraggingInfo dragInfo)
		{
			var list = new List<string>();
			if (dragInfo.DraggingPasteboard.Types.Contains(NSPasteboard.NSFilenamesType))
			{
				NSArray data = dragInfo.DraggingPasteboard.GetPropertyListForType(NSPasteboard.NSFilenamesType) as NSArray;
				if (data != null)
				{
					for (uint idx = 0; idx < data.Count; ++idx)
					{
						string path = NSString.FromHandle(data.ValueAt(idx));
						if (Directory.Exists(path))
						{
							list.Add(path);
						}
					}
				}
			}

			return list;
		}
Example #47
0
 public override bool PrepareForDragOperation(NSDraggingInfo sender)
 {
     return true;
 }
Example #48
0
 public override bool PerformDragOperation(NSDraggingInfo sender)
 {
     NSPasteboard pb = sender.DraggingPasteboard;
     if (!ReadFromPasteboard(pb)) {
         Console.WriteLine("Error: could not read from dragging pasteboard");
         Highlighted = false;
         NeedsDisplay = true;
         return false;
     }
     return true;
 }
Example #49
0
 public override NSDragOperation DraggingUpdated(NSDraggingInfo sender)
 {
     NSDragOperation op = sender.DraggingSourceOperationMask;
     if (sender.DraggingSource == this) {
         return NSDragOperation.None;
     }
     return NSDragOperation.Copy;
 }
Example #50
0
 public override void DraggingExited(NSDraggingInfo sender)
 {
     Highlighted = false;
     NeedsDisplay = true;
 }
Example #51
0
        public override NSDragOperation DraggingEntered(NSDraggingInfo sender)
        {
            if (sender.DraggingSource == this) {
                return NSDragOperation.None;
            }
            Highlighted = true;
            NeedsDisplay = true;

            return NSDragOperation.Copy;
        }
Example #52
0
 public override void ConcludeDragOperation(NSDraggingInfo sender)
 {
     Highlighted = false;
     NeedsDisplay = true;
 }
 public override NSDragOperation DraggingEntered(NSDraggingInfo sender)
 {
     return NSDragOperation.Copy;  
 }
Example #54
0
		public override void ConcludeDragOperation (NSDraggingInfo sender)
		{
			Console.WriteLine ("Drag Delegate received 'ConcludeDragOperation'");
		}
Example #55
0
		public override bool PrepareForDragOperation (NSDraggingInfo sender)
		{
			Console.WriteLine ("Drag Delegate received 'PrepareForDragOperation'");
			return true;
		}
Example #56
0
		public override NSDragOperation DraggingEntered (NSDraggingInfo sender)
		{
			// When we start dragging, inform the system that we will be handling this as
			// a copy/paste
			return NSDragOperation.Copy;
		}
Example #57
0
		public override NSDragOperation DraggingEntered (NSDraggingInfo sender)
		{
			Console.WriteLine ("Drag Delegate received 'DraggingEntered'");
			return DraggingUpdated (sender);
		}
 public override void DraggingEnded (NSDraggingInfo sender)
 {
     // Update the dropped item counter and display
    
 }
Example #59
0
 public override NSDragOperation DraggingEntered(NSDraggingInfo sender)
 {
     return DraggingUpdated(sender);
 }
Example #60
0
		public override void DraggingEnded (NSDraggingInfo sender)
		{
			Console.WriteLine ("Drag Delegate received 'DraggingEnded'");
		}