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
/* ------------ Search Field ------------- */ | |
searchField = [CPTextField roundedTextFieldWithStringValue:@"" placeholder:@"Location" width:200.0]; | |
[searchField setFrameOrigin:CGPointMake(510.0, 35.0)]; | |
[searchField setDelegate:self]; | |
[contentView addSubview:searchField]; | |
/* ----------- Search Button ------------------- */ | |
var searchButton = [[CPButton alloc] initWithFrame:CGRectMake(710.0, 37.0, 60.0, 24.0)]; | |
[searchButton setTitle:"Search"]; | |
[searchButton setTarget:self]; |
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
// Delegate method for the locationListView | |
- (void)collectionViewDidChangeSelection:(CPCollectionView)aCollectionView | |
{ | |
[locationDetailController setLocation:[self selectedLocation]]; | |
} |
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
/* ------- Location Detail Controller ----- */ | |
locationDetailController = [[LocationDetailController alloc] init]; | |
locationDetailController.mapController = mapController; | |
locationsController.locationDetailController = locationDetailController; | |
[mapController setDelegate:locationDetailController]; | |
/* ------- Location Detail View ---------- */ | |
locationDetailView = [[LocationDetailView alloc] initWithFrame:CGRectMake(510, 490, 400, 90)]; | |
[locationDetailView setDelegate:locationDetailController]; | |
[locationDetailController setLocationDetailView:locationDetailView]; |
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
@import <Foundation/CPObject.j> | |
@import "Location.j" | |
@import "MapController.j" | |
@import "LocationsController.j" | |
@import "LocationDetailView.j" | |
@implementation LocationDetailController : CPObject | |
{ | |
Location location; | |
MapController mapController @accessors; |
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
@import <AppKit/CPView.j> | |
@implementation LocationDetailView : CPView | |
{ | |
CPTextField locationNameField; | |
id delegate @accessors; | |
} | |
- (id)initWithFrame:(CGRect)aFrame | |
{ |
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
- (void)addLocation { | |
if (!locations) { | |
locations = [[CPArray alloc] init]; | |
} | |
loc = [[Location alloc] init]; | |
[loc setDescription:@""]; | |
[loc setPosition:([locations count] + 1)]; | |
[locations addObject:loc]; | |
[locationListView setContent:locations]; |
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
/* ---- Locations Toolbar ----- */ | |
locationsToolbar = [[LocationsToolbar alloc] initWithFrame:CGRectMake(10.0, 467.0, 226.0, 25.0)]; | |
[locationsToolbar setDelegate:locationsController]; | |
[contentView addSubview:locationsToolbar]; |
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
@import <AppKit/CPView.j> | |
@implementation LocationsToolbar : CPView | |
{ | |
CPButton addButton; | |
CPButton removeButton; | |
id delegate @accessors; | |
} | |
- (id)initWithFrame:(CGRect)aFrame |
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
// Delegate method for the locationListView | |
- (void)collectionViewDidChangeSelection:(CPCollectionView)aCollectionView | |
{ | |
var loc = [locationsController selectedLocation]; | |
[mapController moveMapToLat:[loc latitude] andLng:[loc longitude]]; | |
} |
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
@import <Foundation/CPObject.j> | |
@import "Location.j" | |
@import "DemoData.j" | |
@import "LocationListView.j" | |
@implementation LocationsController : CPObject | |
{ | |
CPArray locations; | |
LocationListView locationListView @accessors; | |
} |