Created
September 8, 2009 14:02
-
-
Save jfahrenkrug/182931 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
* Locations | |
* | |
* Created by Johannes Fahrenkrug on September 8, 2009. | |
* Copyright 2009, Your Company All rights reserved. | |
*/ | |
@import <Foundation/CPObject.j> | |
@import "Location.j" | |
@import "LocationsController.j" | |
@implementation AppController : CPObject | |
{ | |
LocationsController locationsController; | |
} | |
- (void)applicationDidFinishLaunching:(CPNotification)aNotification | |
{ | |
var theWindow = [[CPWindow alloc] initWithContentRect:CGRectMakeZero() styleMask:CPBorderlessBridgeWindowMask], | |
mainContentView = [theWindow contentView], | |
bounds = [contentView bounds]; | |
// Make the background blue-ish. | |
[mainContentView setBackgroundColor:[CPColor colorWithRed:212.0 / 255.0 green:221.0 / 255.0 blue:230.0 / 255.0 alpha:1.0]]; | |
// Create and Center our Container View | |
var contentView = [[CPView alloc] initWithFrame:CGRectMake(0, 0, 920.0, 590.0)]; | |
[contentView setCenter:[mainContentView center]]; | |
[contentView setBackgroundColor:[CPColor whiteColor]]; | |
[contentView setAutoresizingMask:CPViewMinXMargin | CPViewMaxXMargin | CPViewMinYMargin | CPViewMaxYMargin]; | |
// Add shadow | |
var shadow = [[CPShadowView alloc] initWithFrame:CGRectMakeZero()]; | |
[shadow setFrameForContentFrame:[contentView frame]]; | |
[shadow setAutoresizingMask:CPViewMinXMargin | CPViewMaxXMargin | CPViewMinYMargin | CPViewMaxYMargin]; | |
[mainContentView addSubview:shadow]; | |
[mainContentView addSubview:contentView]; | |
//Create the LocationsController | |
locationsController = [[LocationsController alloc] init]; | |
//Load example data | |
[locationsController loadExampleLocations]; | |
//Let's see if it worked | |
alert([[locationsController locations] count]); | |
alert([[[locationsController locations] objectAtIndex:0] description]); | |
[theWindow orderFront:self]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment