Created
November 23, 2011 13:03
-
-
Save bpowers/1388617 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 <AppKit/CPToolbar.j> | |
@import <AppKit/CPToolbarItem.j> | |
var LogoToolbarItemIdentifier = "LogoToolbarItemIdentifier"; | |
@implementation AppController : CPObject { | |
} | |
- (void)applicationDidFinishLaunching:(CPNotification)aNotification { | |
CPLogRegister(CPLogPopup); | |
var theWindow = [[CPWindow alloc] | |
initWithContentRect:CGRectMakeZero() | |
styleMask:CPBorderlessBridgeWindowMask], | |
contentView = [theWindow contentView]; | |
[contentView setBackgroundColor:[CPColor whiteColor]]; | |
[theWindow orderFront:self]; | |
var toolbar = [[CPToolbar alloc] init]; | |
[toolbar setDelegate:self]; | |
[toolbar setVisible:YES]; | |
[theWindow setToolbar:toolbar]; | |
[theWindow orderFront:self]; | |
} | |
- (CPArray)toolbarAllowedIdentifiers:(CPToolbar)aToolbar { | |
return [LogoToolbarItemIdentifier]; | |
} | |
- (CPArray)toolbarDefaultItemIdentifiers:(CPToolbar)aToolbar { | |
return [LogoToolbarItemIdentifier]; | |
} | |
- (CPToolbarItem)toolbar:(CPToolbar)aToolbar itemForItemIdentifier:(CPString)anIdentifier willBeInsertedIntoToolbar:(CPBOOL)aFlag { | |
var item = [[CPToolbarItem alloc] initWithItemIdentifier:anIdentifier]; | |
if (anIdentifier == LogoToolbarItemIdentifier) { | |
var image = [[CPImage alloc] | |
initWithContentsOfFile:[[CPBundle mainBundle] | |
pathForResource:@"logo.png"] | |
size:CPSizeMake(214, 59)]; | |
[item setImage:image]; | |
[item setLabel:""]; | |
[item setMinSize:CGSizeMake(20, 48)]; | |
[item setMaxSize:CGSizeMake(174, 80)]; | |
[item setTarget:self]; | |
[item setAction:@selector(logoClick)]; | |
} | |
return item; | |
} | |
- (void)logoClick { | |
// when we click on the logo, simply go back to the manager. | |
window.location = "/"; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment