Guest User

Untitled

a guest
Feb 21st, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.62 KB | None | 0 0
  1. //
  2. // SFTable.j
  3. // XYZRadio
  4. //
  5. // Created by Alos on 10/2/08.
  6. //
  7. import <Foundation/CPObject.j>
  8. import "Song.j"
  9.  
  10. SongsDragType = @"SongsDragType";
  11.  
  12. @implementation SFTable : CPView
  13. {
  14. /*Para las tablas*/
  15. CPCollectionView collectionView;
  16. ...
  17. }
  18.  
  19. -(void) initWithColumnModel:(CPArray)aColumnModel model:(CPArray)aModel frame:(CGRect)bounds{
  20. ....
  21.  
  22. [collectionView setItemPrototype: listItem];
  23. [collectionView setMaxNumberOfColumns:1];
  24. [collectionView setMinItemSize:CPSizeMake(CGRectGetWidth(bounds), 20)];
  25. [collectionView setMaxItemSize:CPSizeMake(CGRectGetWidth(bounds), 20)];
  26. [collectionView setContent: model];
  27. [self addSubview:scrollView];
  28.  
  29.  
  30. //DELEGATE?
  31. [collectionView setDelegate: self];
  32.  
  33. ....
  34. return self;
  35. }
  36. //DELEGATE METHODS
  37. -(int)didDoubleClickOnItemAtIndex:(int)index{
  38. console.log("Someone clicked: %d",index);
  39. }
  40.  
  41. - (void)performDragOperation:(id <CPDraggingInfo>)aSender
  42. {
  43. // If this is us, don't add it.
  44. if ([aSender draggingSource] == collectionView)
  45. return;
  46.  
  47. var pasteboard = [aSender draggingPasteboard];
  48.  
  49. if ([[pasteboard types] containsObject:SongsDragType])
  50. {
  51. songs = [CPKeyedUnarchiver unarchiveObjectWithData:[pasteboard dataForType:SongsDragType]];
  52.  
  53. var index = 0,
  54. count = songs.length;
  55.  
  56. for (; index < count; ++index){
  57. if(![[collectionView content]containsObject:songs[index]])
  58. [self addItem:songs[index]];
  59. else
  60. console.log("Repetido!");
  61. }
  62.  
  63. }
  64. }
  65. //END OF DELEGATE METHODS
  66. ....
Add Comment
Please, Sign In to add comment