Skip to content

Instantly share code, notes, and snippets.

Created December 18, 2008 04:39
Show Gist options
  • Save anonymous/37379 to your computer and use it in GitHub Desktop.
Save anonymous/37379 to your computer and use it in GitHub Desktop.
@import <Foundation/CPObject.j>
@import "AppInspector.j"
@implementation AppController : CPObject
{
AppImage theImage;
AppInspector theInspector;
}
- (void)applicationDidFinishLaunching:(CPNotification)aNotification
{
var theWindow = [[CPWindow alloc]
initWithContentRect:CGRectMakeZero()
styleMask:CPBorderlessBridgeWindowMask],
contentView = [theWindow contentView];
[contentView setBackgroundColor:[CPColor grayColor]];
[theWindow orderFront:self];
var squareSize = 200;
var borderSize = 5;
var viewSize = ( squareSize*3 ) + ( borderSize*3 );
var horizCoor = ( CGRectGetWidth([contentView bounds]) / 2 ) - ( viewSize / 2 );
theImage = [[AppImage1 alloc] initWithFrame:CGRectMake(borderSize, borderSize, squareSize, squareSize)];
[theImage setImageScaling:CPScaleProportionally];
[theImage setHasShadow:true];
[theImage setImage:[[CPImage alloc]
initWithContentsOfFile:
@"Resources/sample.jpg"
size:CGSizeMake(squareSize, squareSize)]];
[theImage setAction:@selector(labelContents:)];
[contentView addSubview: theImage];
theInspector = [[AppInspector alloc] init];
[theInspector showWindow:self];
}
- (void)labelContents:(CPString)aTitle
{
[theInspector labelContents:aTitle];
}
@end
@implementation AppImage : CPImageView
{
}
- (void) mouseDown: (CPEvent) anEvent
{
//not sure what to do
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment