これは私の最初の投稿です。この挨拶のウェブサイトです。 私は経験豊富なC#、.NetとMonoのユーザーですが、MonoMacのNoob NSViewにフォルダを受け取り、そのパスを使ってフォルダ内のファイルを処理するアプリケーションを作成しようとしています...MonoMac NSViewでドラッグドロップを受信していますか?
MonoMacフレームワークはdraggingEntered:, draggingUpdated:, draggingExited:, prepareForDragOperation:, performDragOperation:, concludeDragOperation: and draggingEnded:
を実装していませんでしたので、私は彼らに自分自身を実装しようとした:
[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);
}
}
をしかし、方法は呼び出されません!
私もRegisterForDraggedTypes
にしようとしましたが、タイプとして文字列配列に何を渡すべきかわかりません!
私がそれを理解するのを助けてください。私は今48のGoogleを検索している!