mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 06:51:44 +00:00
Added performDragOperation:
This commit is contained in:
parent
1725e272c6
commit
c67ca273a9
1 changed files with 26 additions and 19 deletions
|
@ -411,30 +411,37 @@ static NSNotificationCenter *nc = nil;
|
|||
{
|
||||
if (_delegate != nil)
|
||||
{
|
||||
NSDragOperation d = [_delegate pathControl: self
|
||||
validateDrop: sender];
|
||||
if (d == NSDragOperationCopy)
|
||||
NSDragOperation dop = [_delegate pathControl: self
|
||||
validateDrop: sender];
|
||||
return dop;
|
||||
}
|
||||
|
||||
return NSDragOperationNone;
|
||||
}
|
||||
|
||||
- (BOOL) performDragOperation: (id<NSDraggingInfo>)sender
|
||||
{
|
||||
NSPasteboard *pb = [sender draggingPasteboard];
|
||||
if ([[pb types] containsObject: NSFilenamesPboardType])
|
||||
{
|
||||
NSArray *files = [pb propertyListForType: NSFilenamesPboardType];
|
||||
if ([files count] > 0)
|
||||
{
|
||||
NSPasteboard *pb = [sender draggingPasteboard];
|
||||
if ([[pb types] containsObject: NSFilenamesPboardType])
|
||||
NSString *file = [files objectAtIndex: 0];
|
||||
NSURL *u = [NSURL URLWithString: file];
|
||||
BOOL accept = [_delegate pathControl: self
|
||||
acceptDrop: sender];
|
||||
if (accept)
|
||||
{
|
||||
NSArray *files = [pb propertyListForType: NSFilenamesPboardType];
|
||||
if ([files count] > 0)
|
||||
{
|
||||
NSString *file = [files objectAtIndex: 0];
|
||||
NSURL *u = [NSURL URLWithString: file];
|
||||
BOOL accept = [_delegate pathControl: self
|
||||
acceptDrop: sender];
|
||||
if (accept)
|
||||
{
|
||||
[self setURL: u];
|
||||
}
|
||||
}
|
||||
[self setURL: u];
|
||||
}
|
||||
else
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NSDragOperationNone;
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void) setFrame: (NSRect)frame
|
||||
|
|
Loading…
Reference in a new issue