Skip to content

Instantly share code, notes, and snippets.

@richcollins
Created September 8, 2008 05:03
Show Gist options
  • Save richcollins/9377 to your computer and use it in GitHub Desktop.
Save richcollins/9377 to your computer and use it in GitHub Desktop.
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 imageView = [[CPImageView alloc] initWithFrame:CGRectMake(0, 0, 300, 300)];
[imageView setImage: theImage];
var collectionView = [[CPCollectionView alloc] initWithFrame:CGRectMake(
CGRectGetWidth([contentView bounds])/2.0 - 450, CGRectGetHeight([contentView bounds])/2.0 - 150,
900, 150
)];
var collection = [imageView, imageView, imageView];
[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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment