-
-
Save boucher/37381 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> | |
@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