Created
December 30, 2008 02:07
-
-
Save jwalgran/41488 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
/* | |
* AppController.j | |
* | |
* Created by __Me__ on __Date__. | |
* Copyright 2008 __MyCompanyName__. All rights reserved. | |
*/ | |
@import <Foundation/CPObject.j> | |
var UploadToolbarItemIdentifier = @"UploadToolbarItemIdentifier"; | |
@implementation AppController : CPObject | |
{ | |
var _contentView; | |
} | |
- (void)applicationDidFinishLaunching:(CPNotification)aNotification | |
{ | |
var mainWindow = [[CPWindow alloc] initWithContentRect:CGRectMakeZero() styleMask:CPBorderlessBridgeWindowMask] | |
_contentView = [mainWindow contentView]; | |
[_contentView setBackgroundColor:[CPColor blackColor]]; | |
var mainToolbar = [[CPToolbar alloc] initWithIdentifier:@"MainToolbar"] | |
[mainToolbar setDelegate:self]; | |
[mainWindow setToolbar:mainToolbar]; | |
[mainWindow orderFront:self]; | |
} | |
-(CPArray)toolbarDefaultItemIdentifiers:(CPToolbar)toolbar | |
{ | |
return [UploadToolbarItemIdentifier]; | |
} | |
-(CPArray)toolbarAllowedItemIdentifiers:(CPToolbar)toolbar | |
{ | |
return [UploadToolbarItemIdentifier]; | |
} | |
- (CPToolbarItem)toolbar:(CPToolbar)toolbar itemForItemIdentifier:(CPString)itemIdentifier willBeInsertedIntoToolbar:(BOOL)flag | |
{ | |
var aToolbarItem = [[CPToolbarItem alloc] initWithItemIdentifier:itemIdentifier]; | |
if (itemIdentifier == UploadToolbarItemIdentifier) | |
{ | |
var image = [[CPImage alloc] initWithContentsOfFile:"Resources/page_up.png" size:CPSizeMake(32, 32)]; | |
[aToolbarItem setLabel:@"Upload"]; | |
[aToolbarItem setPaletteLabel:@"Upload"]; | |
[aToolbarItem setImage:image]; | |
[aToolbarItem setToolTip:@"Upload"]; | |
[aToolbarItem setMinSize:CGSizeMake(48, 48)]; | |
[aToolbarItem setMaxSize:CGSizeMake(48, 48)]; | |
[aToolbarItem setTarget: self]; | |
[aToolbarItem setAction: @selector(upload:)] | |
[aToolbarItem setEnabled: YES]; | |
} | |
return aToolbarItem; | |
} | |
- (void)upload:(id)aSender | |
{ | |
[_contentView setBackgroundColor:[CPColor whiteColor]]; | |
} | |
@end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment