Created
September 9, 2008 21:35
-
-
Save richcollins/9770 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import <Foundation/CPObject.j> | |
@implementation AppController : CPObject | |
{ | |
} | |
- (void)applicationDidFinishLaunching:(CPNotification)aNotification | |
{ | |
var theWindow = [[CPWindow alloc] | |
initWithContentRect:CGRectMakeZero() | |
styleMask:CPBorderlessBridgeWindowMask | |
] | |
var contentView = [theWindow contentView]; | |
var theImage = [[CPImage alloc] initByReferencingFile:"cappuccino-icon.png" size:CPSizeMake(300, 300)]; | |
var imageItem = [[CPCollectionViewItem alloc] init]; | |
[imageItem setView: [[ImageCell alloc] initWithFrame:CGRectMake(0, 0, 300, 300)]]; | |
var collectionView = [[CPCollectionView alloc] initWithFrame:CGRectMake( | |
CGRectGetWidth([contentView bounds])/2.0 - 450, CGRectGetHeight([contentView bounds])/2.0 - 150, | |
900, 150 | |
)]; | |
[collectionView setItemPrototype:imageItem]; | |
var collection = [theImage, theImage, theImage]; | |
[collectionView setContent: [CPArray arrayWithArray:collection]]; | |
[contentView addSubview:collectionView]; | |
/* | |
var outerScrollView = [[CPScrollView alloc] initWithFrame:CGRectMake( | |
CGRectGetWidth([contentView bounds])/2.0 - 450, CGRectGetHeight([contentView bounds])/2.0 - 75, | |
900, 150 | |
)]; | |
[outerScrollView setAutoresizingMask:CPViewMinXMargin | CPViewMaxXMargin | CPViewMinYMargin | CPViewMaxYMargin]; | |
[outerScrollView setDocumentView: imageView]; | |
[outerScrollView setHasHorizontalScroller: NO]; | |
for(var i = 0; i < 6; i++) | |
{ | |
} | |
var scrollView = [[CPScrollView alloc] initWithFrame:CGRectMake( | |
CGRectGetWidth([contentView bounds])/2.0 - 75, CGRectGetHeight([contentView bounds])/2.0 - 75, | |
150, 150 | |
)]; | |
[scrollView setAutoresizingMask:CPViewMinXMargin | CPViewMaxXMargin | CPViewMinYMargin | CPViewMaxYMargin]; | |
[scrollView setDocumentView: imageView]; | |
[scrollView setHasHorizontalScroller: NO]; | |
[contentView addSubview: scrollView];*/ | |
[theWindow orderFront:self]; | |
} | |
@end | |
@implementation ImageCell : CPImageView | |
{ | |
} | |
- (void)setRepresentedObject:(JSObject)theImage | |
{ | |
[self setImage: theImage]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment