Skip to content

Instantly share code, notes, and snippets.

@jfahrenkrug
Created September 8, 2009 14:02
Show Gist options
  • Save jfahrenkrug/182931 to your computer and use it in GitHub Desktop.
Save jfahrenkrug/182931 to your computer and use it in GitHub Desktop.
/*
* 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