Skip to content

Instantly share code, notes, and snippets.

@boucher
Forked from anonymous/gist:37379
Created December 18, 2008 04:42
Show Gist options
  • Save boucher/37381 to your computer and use it in GitHub Desktop.
Save boucher/37381 to your computer and use it in GitHub Desktop.
@import <Foundation/CPObject.j>
@import "AppInspector.j"
@implementation AppController : CPObject
{
CPImageView imageView;
AppInspector inspector;
}
- (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 );
imageView = [[CPImageView alloc] initWithFrame:CGRectMake(borderSize, borderSize, squareSize, squareSize)];
[imageView setImageScaling:CPScaleProportionally];
[imageView setHasShadow:true];
[imageView setImage:[[CPImage alloc]
initWithContentsOfFile:
@"Resources/sample.jpg"
size:CGSizeMake(squareSize, squareSize)]];
[imageView setTarget:self];
[imageView setAction:@selector(labelContents:)];
[contentView addSubview: imageView];
theInspector = [[AppInspector alloc] init];
[theInspector showWindow:self];
}
- (void)labelContents:(id)sender
{
//replace this with whateer you want
var title = [[sender image] filename];
[theInspector setStringValue:title];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment