Skip to content

Instantly share code, notes, and snippets.

View jfahrenkrug's full-sized avatar

Johannes Fahrenkrug jfahrenkrug

View GitHub Profile
/* ----- Map Controller --------------- */
mapController = [[MapController alloc] init];
/* ------------- Map View ----------------- */
mapView = [[MKMapView alloc] initWithFrame:CGRectMake(510, 65, 400, 400) apiKey:''];
[mapView setDelegate:self];
mapController.mapView = mapView;
[contentView addSubview:mapView];
/* ---------- Coordinates Label -------------- */
@import <Foundation/CPObject.j>
@import <MapKit/MKMapView.j>
@import "Location.j"
@implementation MapController : CPObject
{
MKMapView mapView @accessors;
CPTextField coordinatesLabel @accessors;
CPString latitude;
CPString longitude;
/* ------------ Locations --------------- */
locationListView = [[LocationListView alloc] initWithFrame:CGRectMake(0.0, 0.0, 226.0, 400.0)];
[locationListView setContent:[locationsController locations]];
//1: we'll add something later
/* --------- Locations ScrollView ---------- */
var locationScrollView = [[CPScrollView alloc] initWithFrame:CGRectMake(10.0, 65.0, 243.0, 400.0)];
[locationScrollView setDocumentView:locationListView];
[locationScrollView setAutohidesScrollers:YES];
[[locationScrollView contentView] setBackgroundColor:[CPColor whiteColor]];
@import <AppKit/CPCollectionView.j>
@implementation LocationListView : CPCollectionView
{
CPCollectionViewItem itemPrototype;
}
- (id)initWithFrame:(CGRect)aFrame
{
self = [super initWithFrame:aFrame];
/*
* 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 <Foundation/CPObject.j>
@import "Location.j"
@import "DemoData.j"
@implementation LocationsController : CPObject
{
CPArray locations;
}
- (void)setLocations:(CPArray)someLocations {
@implementation DemoData : CPObject
+ (CPString)exampleJSONString {
var string = @"[{\"id\": 1, \"latitude\": \"39.099470\", \"longitude\": \"-94.563500\", \"description\": \"Corner of Twelfth and Vine\", \"transportation_kind\": \"\"}, {\"id\": 2, \"latitude\": \"37.802109\", \"longitude\": \"-122.432691\", \"description\": \"Moscone Center West\", \"transportation_kind\": \"S\"}]";
return string;
}
@end
@import <Foundation/CPObject.j>
@implementation Location : CPObject
{
// the id (I don't call it "id" because that's a type in Objective-J)
int identifier @accessors;
CPString description @accessors;
CPString latitude @accessors;
CPString longitude @accessors;
CPString transportationKind @accessors;
@import <Foundation/CPObject.j>
@import "TripDaysController.j"
@import "Trip.j"
@import "DemoData.j"
@import "Settings.j"
@implementation TripsController : CPObject
{
TripDaysController tripDaysController @accessors;
CPTextField tripLabel @accessors;
<?xml version="1.0" encoding="UTF-8"?>
<Module>
<ModulePrefs
title="Owner ID Test"
height="600">
<Require feature="opensocial-0.7"/>
</ModulePrefs>
<Content type="html">