Skip to content

Instantly share code, notes, and snippets.

-(boolean)isEqual:(id)anObject{
if([[anObject class] instancesRespondToSelector:@selector("ID:")])
if([anObject ID]==[self ID])
return YES;
else
return NO;
}
import <Foundation/CPObject.j>
import "Song.j"
var BotonMiListaIdentifier = "BotonMiListaIdentifier",
AddSongToolbarItemIdentifier = "AddSongToolbarItemIdentifier",
RemoveSongToolbarItemIdentifier = "RemoveSongToolbarItemIdentifier";
@implementation AppController : CPObject
-(void)removeSong{
var indexSet = [[libraryCollectionView selectionIndexes] firstIndex];
[librarySongs removeObjectAtIndex: indexSet];
[libraryCollectionView reloadContent];
}
if(colored){
colored=NO;
[titleView setBackgroundColor:[CPColor whiteColor]];
[authorView setBackgroundColor:[CPColor whiteColor]];
alert("Pinte blanco");
}else{
colored=YES;
alert("Pinte azul");
import <Foundation/CPObject.j>
@implementation SFTable : CPView
{
CPCollectionView collectionView;
CPPanel bgPanel
CPArray model;
CPArray title;
}
/**
Removes selected items
*/
-(void)removeSelectedItems{
var indexes= [collectionView selectionIndexes];
var arr = [[CPArray alloc]init];
var a = [[collectionView selectionIndexes] firstIndex];
var b = [[collectionView selectionIndexes] lastIndex];
[indexes getIndexes: arr maxCount: a inIndexRange: CPMakeRange(0, b)];
for(var i=0; i< [arr count];i++){
-(void)removeSelectedItems{
var indexes= [collectionView selectionIndexes];
var arr = [[CPArray alloc]init];
var a = [[collectionView selectionIndexes] firstIndex];
var b = [[collectionView selectionIndexes] lastIndex];
[indexes getIndexes: arr maxCount: a inIndexRange: CPMakeRange(0, 10)];
for(var i=0; i< [arr count];i++){
[model removeObjectAtIndex: [arr indexOfObject: i]];
[collectionView reloadContent];
}
/*The Music browser*/
@implementation SFBrowser : CPWindow
{
SFTable libraryTable;
}
/*Una bonita contructora*/
- (id)initWithSource:(CPArray)list{
//Creamos un HUD como panel para que pueda esta arriba de todas las demas ventanas
self = [[CPPanel alloc] initWithContentRect:CGRectMake(400, 50, 800, 500)styleMask:CPHUDBackgroundWindowMask|CPResizableWindowMask];
import <Foundation/CPObject.j>
import "Song.j"
import "SFTable.j"
import "MyList.j"
import "SFBrowser.j"
import "SFColumnModel.j"
var BotonBrowserIdentifier = "BotonBrowserIdentifier" ,
BotonMiListaIdentifier = "BotonMiListaIdentifier",
AddSongToolbarItemIdentifier = "AddSongToolbarItemIdentifier",
RemoveSongToolbarItemIdentifier = "RemoveSongToolbarItemIdentifier";
@Alos
Alos / SFTable
Created September 29, 2008 04:08
import <Foundation/CPObject.j>
import "Song.j"
@implementation SFTable : CPView
{
/*Para las tablas*/
CPCollectionView collectionView;
CPArray model;
/*Cosas para los titulos*/
CPArray columnModel