diff options
Diffstat (limited to 'cocoa/ScintillaView.mm')
| -rw-r--r-- | cocoa/ScintillaView.mm | 63 | 
1 files changed, 39 insertions, 24 deletions
| diff --git a/cocoa/ScintillaView.mm b/cocoa/ScintillaView.mm index d5f658755..13dd1d4f9 100644 --- a/cocoa/ScintillaView.mm +++ b/cocoa/ScintillaView.mm @@ -731,6 +731,45 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor)  //--------------------------------------------------------------------------------------------------  /** + * Implement NSDraggingSource. + */ + +- (NSDragOperation)draggingSession: (NSDraggingSession *) session +sourceOperationMaskForDraggingContext: (NSDraggingContext) context +{ +  switch(context) +  { +    case NSDraggingContextOutsideApplication: +      return NSDragOperationCopy | NSDragOperationMove | NSDragOperationDelete; +       +    case NSDraggingContextWithinApplication: +    default: +      return NSDragOperationCopy | NSDragOperationMove | NSDragOperationDelete; +  } +} + +- (void)draggingSession:(NSDraggingSession *)session +           movedToPoint:(NSPoint)screenPoint +{ +} + +- (void)draggingSession:(NSDraggingSession *)session +           endedAtPoint:(NSPoint)screenPoint +              operation:(NSDragOperation)operation +{ +  if (operation == NSDragOperationDelete) +  { +    mOwner.backend->WndProc(SCI_CLEAR, 0, 0); +  } +} + +/** + * Implement NSDraggingDestination. + */ + +//-------------------------------------------------------------------------------------------------- + +/**   * Called when an external drag operation enters the view.   */  - (NSDragOperation) draggingEntered: (id <NSDraggingInfo>) sender @@ -776,30 +815,6 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor)  //--------------------------------------------------------------------------------------------------  /** - * Returns operations we allow as drag source. - */ -- (NSDragOperation) draggingSourceOperationMaskForLocal: (BOOL) isLocal -{ -// Scintilla does not choose different operations for other applications -#pragma unused(isLocal) -  return NSDragOperationCopy | NSDragOperationMove | NSDragOperationDelete; -} - -//-------------------------------------------------------------------------------------------------- - -/** - * Finished a drag: may need to delete selection. - */ - -- (void)draggedImage:(NSImage *)image endedAt:(NSPoint)screenPoint operation:(NSDragOperation)operation { -    if (operation == NSDragOperationDelete) { -        mOwner.backend->WndProc(SCI_CLEAR, 0, 0); -    } -} - -//-------------------------------------------------------------------------------------------------- - -/**   * Drag operation is done. Notify editor.   */  - (void) concludeDragOperation: (id <NSDraggingInfo>) sender | 
