This is my first post here on this welcome site. I am an experienced C #, Net and Mono user, but Noob in MonoMac, I am trying to write an application that receives a folder in NSView and uses its path to work with files inside the folder ...
The MonoMac framework did not implement draggingEntered:, draggingUpdated:, draggingExited:, prepareForDragOperation:, performDragOperation:, concludeDragOperation: and draggingEnded:
So I tried to implement them myself:
[Register("TargetView")] public class TargetView:NSView { private static IntPtr selDraggingEntered = Selector.GetHandle ("draggingEntered:"); private static IntPtr selDraggingUpdated = Selector.GetHandle ("draggingUpdated:"); private static IntPtr selDraggingExited = Selector.GetHandle ("draggingExited:"); private static IntPtr selPrepareForDragOperation = Selector.GetHandle ("prepareForDragOperation:"); private static IntPtr selPerformDragOperation = Selector.GetHandle ("performDragOperation:"); private static IntPtr selConcludeDragOperation = Selector.GetHandle ("concludeDragOperation:"); private static IntPtr selDraggingEnded = Selector.GetHandle ("draggingEnded:"); public TargetView():base(){ } public TargetView(NSCoder coder):base(coder){ } public TargetView(NSObjectFlag t):base(t){ } public TargetView(IntPtr handle):base(handle){ } public TargetView(RectangleF frameRect):base(frameRect){ } [Export ("draggingEntered:")] public virtual NSDragOperation DraggingEntered (NSDraggingInfo sender) { if (sender == null) { throw new ArgumentNullException ("sender"); } if (this.IsDirectBinding) { return (NSDragOperation)Messaging.int_objc_msgSend_int (base.Handle, TargetView.selDraggingEntered, (int)sender.DraggingSourceOperationMask); } return (NSDragOperation)Messaging.int_objc_msgSendSuper_int (base.Handle, TargetView.selDraggingEntered, (int)sender.DraggingSourceOperationMask); } [Export ("draggingUpdated:")] public virtual NSDragOperation DraggingUpdated (NSDraggingInfo sender) { if (sender == null) { throw new ArgumentNullException ("sender"); } if (this.IsDirectBinding) { return (NSDragOperation)Messaging.int_objc_msgSend_int (base.Handle, TargetView.selDraggingUpdated, (int)sender.DraggingSourceOperationMask); } return (NSDragOperation)Messaging.int_objc_msgSendSuper_int (base.Handle, TargetView.selDraggingUpdated, (int)sender.DraggingSourceOperationMask); } [Export ("draggingExited:")] public virtual void DraggingExited (NSDraggingInfo sender) { if (sender == null) { throw new ArgumentNullException ("sender"); } if (this.IsDirectBinding) { Messaging.void_objc_msgSend_int (base.Handle, TargetView.selDraggingExited, (int)sender.DraggingSourceOperationMask); } Messaging.void_objc_msgSendSuper_int (base.Handle, TargetView.selDraggingExited, (int)sender.DraggingSourceOperationMask); } [Export ("prepareForDragOperation:")] public virtual bool PrepareForDragOperation (NSDraggingInfo sender) { if (sender == null) { throw new ArgumentNullException ("sender"); } if (this.IsDirectBinding) { return Messaging.bool_objc_msgSend_int (base.Handle, TargetView.selPrepareForDragOperation, (int)sender.DraggingSourceOperationMask); } return Messaging.bool_objc_msgSendSuper_int (base.Handle, TargetView.selPrepareForDragOperation, (int)sender.DraggingSourceOperationMask); } [Export ("performDragOperation:")] public virtual bool PerformDragOperation (NSDraggingInfo sender) { if (sender == null) { throw new ArgumentNullException ("sender"); } if (this.IsDirectBinding) { return Messaging.bool_objc_msgSend_int (base.Handle, TargetView.selPerformDragOperation, (int)sender.DraggingSourceOperationMask); } return Messaging.bool_objc_msgSendSuper_int (base.Handle, TargetView.selPerformDragOperation, (int)sender.DraggingSourceOperationMask); } [Export ("concludeDragOperation:")] public virtual void ConcludeDragOperation (NSDraggingInfo sender) { if (sender == null) { throw new ArgumentNullException ("sender"); } if (this.IsDirectBinding) { Messaging.void_objc_msgSend_int (base.Handle, TargetView.selConcludeDragOperation, (int)sender.DraggingSourceOperationMask); } Messaging.void_objc_msgSendSuper_int (base.Handle, TargetView.selConcludeDragOperation, (int)sender.DraggingSourceOperationMask); } [Export ("draggingEnded:")] public virtual void DraggingEnded (NSDraggingInfo sender) { if (sender == null) { throw new ArgumentNullException ("sender"); } if (this.IsDirectBinding) { Messaging.void_objc_msgSend_int (base.Handle, TargetView.selDraggingEnded, (int)sender.DraggingSourceOperationMask); } Messaging.void_objc_msgSendSuper_int (base.Handle, TargetView.selDraggingEnded, (int)sender.DraggingSourceOperationMask); } }
But methods are not called!
I also tried RegisterForDraggedTypes , but I have no idea what to pass to a string array as a type!
Please help me sort it out. I searched google for 48 now!