Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // SFTable.j
- // XYZRadio
- //
- // Created by Alos on 10/2/08.
- //
- import <Foundation/CPObject.j>
- import "Song.j"
- SongsDragType = @"SongsDragType";
- @implementation SFTable : CPView
- {
- /*Para las tablas*/
- CPCollectionView collectionView;
- ...
- }
- -(void) initWithColumnModel:(CPArray)aColumnModel model:(CPArray)aModel frame:(CGRect)bounds{
- ....
- [collectionView setItemPrototype: listItem];
- [collectionView setMaxNumberOfColumns:1];
- [collectionView setMinItemSize:CPSizeMake(CGRectGetWidth(bounds), 20)];
- [collectionView setMaxItemSize:CPSizeMake(CGRectGetWidth(bounds), 20)];
- [collectionView setContent: model];
- [self addSubview:scrollView];
- //DELEGATE?
- [collectionView setDelegate: self];
- ....
- return self;
- }
- //DELEGATE METHODS
- -(int)didDoubleClickOnItemAtIndex:(int)index{
- console.log("Someone clicked: %d",index);
- }
- - (void)performDragOperation:(id <CPDraggingInfo>)aSender
- {
- // If this is us, don't add it.
- if ([aSender draggingSource] == collectionView)
- return;
- var pasteboard = [aSender draggingPasteboard];
- if ([[pasteboard types] containsObject:SongsDragType])
- {
- songs = [CPKeyedUnarchiver unarchiveObjectWithData:[pasteboard dataForType:SongsDragType]];
- var index = 0,
- count = songs.length;
- for (; index < count; ++index){
- if(![[collectionView content]containsObject:songs[index]])
- [self addItem:songs[index]];
- else
- console.log("Repetido!");
- }
- }
- }
- //END OF DELEGATE METHODS
- ....
Add Comment
Please, Sign In to add comment