MovieReceiver.m 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. //
  2. // MovieReceiver.m
  3. // iPodConverter
  4. //
  5. // Created by Pierre d'Herbemont on 1/12/08.
  6. // Copyright 2008 __MyCompanyName__. All rights reserved.
  7. //
  8. #import "MovieReceiver.h"
  9. /**********************************************************
  10. * This handles drag-and-drop in the main window
  11. */
  12. @implementation MovieReceiver
  13. - (void)awakeFromNib
  14. {
  15. [self registerForDraggedTypes:[NSArray arrayWithObjects:NSFilenamesPboardType, NSURLPboardType, nil]];
  16. }
  17. - (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender
  18. {
  19. return NSDragOperationGeneric;
  20. }
  21. - (NSDragOperation)performDragOperation:(id <NSDraggingInfo>)sender
  22. {
  23. NSPasteboard *pboard = [sender draggingPasteboard];
  24. if ( [[pboard types] containsObject:NSFilenamesPboardType] )
  25. {
  26. NSArray *files = [pboard propertyListForType:NSFilenamesPboardType];
  27. for( NSString * filename in files )
  28. {
  29. [controller setMedia:[VLCMedia mediaWithPath:filename]];
  30. }
  31. }
  32. return YES;
  33. return NSDragOperationGeneric;
  34. }
  35. @end