Skip to content

Instantly share code, notes, and snippets.

@Synvox
Created June 8, 2011 13:35
Show Gist options
  • Save Synvox/1014426 to your computer and use it in GitHub Desktop.
Save Synvox/1014426 to your computer and use it in GitHub Desktop.
@import <Foundation/CPObject.j>
@import "UploadButton.j"
@import "FileLabel.j"
@implementation Uploader : CPObject
{
var cib;
@outlet CPWindow uploaderWindow;
@outlet UploadButton uploadButton;
@outlet CPButton upload;
@outlet CPCollectionView fileList;
}
- (id)init
{
if (self = [super init])
{
cib = [[CPViewController alloc] initWithCibName:"Uploader" bundle:nil owner:self];
}
return self;
}
- (void)awakeFromCib
{
[uploaderWindow center];
[uploadButton setup:self];
[uploadButton allowsMultipleFiles:YES];
}
- (void) start
{
[cib loadView];
}
- (void) update
{
var itemPrototype = [[CPCollectionViewItem alloc] init];
var z = [[FileLabel alloc] init];
[itemPrototype setView:z];
[fileList setItemPrototype:itemPrototype];
var given = [uploadButton selection];
for(var i = 0; i < [given count]; i++)
alert(given[i]);
[fileList setContent:given];
}
- (@action) uploadFiles:(id)sender
{
alert([uploadButton selection]);
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment