Skip to content

Instantly share code, notes, and snippets.

@boucher
Forked from anonymous/gist:16007
Created October 10, 2008 06:28
Show Gist options
  • Save boucher/16008 to your computer and use it in GitHub Desktop.
Save boucher/16008 to your computer and use it in GitHub Desktop.
import <Foundation/CPObject.j>
@implementation AppController : CPObject
{
CPTextField label;
}
- (void)applicationDidFinishLaunching:(CPNotification)aNotification
{
var theWindow = [[CPWindow alloc] initWithContentRect:CGRectMakeZero() styleMask:CPBorderlessBridgeWindowMask],
contentView = [theWindow contentView];
label = [[CPTextField alloc] initWithFrame:CGRectMakeZero()];
[label setStringValue:@"Hello World!"];
[label setFont:[CPFont boldSystemFontOfSize:24.0]];
[label sizeToFit];
[label setAutoresizingMask:CPViewMinXMargin | CPViewMaxXMargin | CPViewMinYMargin | CPViewMaxYMargin];
[label setFrameOrigin:CGPointMake((CGRectGetWidth([contentView bounds]) - CGRectGetWidth([label frame])) / 2.0, (CGRectGetHeight([contentView bounds]) - CGRectGetHeight([label frame])) / 2.0)];
var request = [CPURLRequest requestWithURL:"http://gignit.com/actions/sessionid.cgi"];
[CPURLConnection connectionWithRequest:request delegate:self];
[contentView addSubview:label];
[theWindow orderFront:self];
// Uncomment the following line to turn on the standard menu bar.
//[CPMenu setMenuBarVisible:YES];
}
- (void)connection:(CPURLConnection)aConnection didReceiveData:(CPString)data
{
[label setStringValue: data];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment