Skip to content

Instantly share code, notes, and snippets.

View jfahrenkrug's full-sized avatar

Johannes Fahrenkrug jfahrenkrug

View GitHub Profile
@import <AppKit/CPView.j>
@implementation LocationDetailView : CPView
{
CPTextField locationNameField;
id delegate @accessors;
}
- (id)initWithFrame:(CGRect)aFrame
{
@import <Foundation/CPObject.j>
@import "Location.j"
@import "MapController.j"
@import "LocationsController.j"
@import "LocationDetailView.j"
@implementation LocationDetailController : CPObject
{
Location location;
MapController mapController @accessors;
/* ------- 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];
// Delegate method for the locationListView
- (void)collectionViewDidChangeSelection:(CPCollectionView)aCollectionView
{
[locationDetailController setLocation:[self selectedLocation]];
}
/* ------------ 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];
- (void)controlTextDidEndEditing:(id)sender {
if ([sender object] == searchField) {
[self searchLocation];
}
}
- (void)searchLocation {
if ([searchField stringValue]) {
[mapController moveMapToAddress:[searchField stringValue]];
[locationDetailController setNameIfEmpty:[searchField stringValue]];
class Foo < ActiveRecord::Base
def self.test_big_text
text = %{<r:trip>
<h1><r:countries/></h1>
<div class="dtIntro clearfix">
<div class="grid g460">
<h2 class="bold"><r:title/></h2>
<h3><r:trip_kind_description/> ab <strong>&euro; <r:baseprice/></strong></h3>
</div>
@interface IconViewBox : NSBox
{
IBOutlet id delegate;
}
@end
@implementation IconViewBox
// -------------------------------------------------------------------------------
// hitTest:aPoint
// -------------------------------------------------------------------------------
- (NSView *)hitTest:(NSPoint)aPoint
{
// don't allow any mouse clicks for subviews in this view
if(NSPointInRect(aPoint,[self convertRect:[self bounds] toView:[self superview]])) {
return self;
#import <Cocoa/Cocoa.h>
@interface IconCollectionItem : NSCollectionViewItem {
}
- (void)doubleClick:(id)sender;
@end