Skip to content

Instantly share code, notes, and snippets.

var subviews = _subviews;
_subviews = [];
[super encodeWithCoder:aCoder];
_subviews = subviews;
- (void)drawInContext:(CGContext)aContext
{
[super drawInContext:aContext];
var bounds = [self bounds];
if (_fill && _geometry)
{
[_geometry setPathForContext:aContext bounds:bounds adjustments:_adjustmentValues];
[_fill fillPathInLayer:self inContext:aContext];
_styleControl = [[FormatSegmentedControl alloc] initWithFrame:CGRectMake(0.0, 0.0, 0.0, 18.0)];
[_styleControl setTrackingMode:CPSegmentSwitchTrackingSelectAny];
[_styleControl setSegmentCount:3];
[_styleControl setAction:@selector(changeTextStyle:)];
[_styleControl setWidth:22.0 forSegment:0];
[_styleControl setImage:FormattingBoldImage forSegment:0];
[_styleControl setTag:0 forSegment:0];
@boucher
boucher / gist:23760
Created November 11, 2008 05:56
Color Well Pop Up Thing
var FormatColorWellBackgroundColor = nil,
FormatColorWellHighlightedBackgroundColor = nil;
var FormatColorWellMenu = nil;
@implementation FormatColorWell : CPColorWell
{
BOOL _hasNilColor;
BOOL _showsNilColor;
}
var SharedLoginController = nil;
@implementation LoginController : CPObject
{
CPString _email;
CPString _sessionID;
int _userID;
BOOL _finishedLoading;
// Add a text field to the cell
cell = [tableView dequeueReusableCellWithIdentifier:@"usernameCell"];
if (!cell)
{
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:@"usernameCell"] autorelease];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
cell.text = @"username";
cell.font = [UIFont boldSystemFontOfSize:16.0];
@boucher
boucher / gist:37381
Created December 18, 2008 04:42 — forked from anonymous/gist:37379
@import <Foundation/CPObject.j>
@import "AppInspector.j"
@implementation AppController : CPObject
{
CPImageView imageView;
AppInspector inspector;
}
- (void)applicationDidFinishLaunching:(CPNotification)aNotification
/* -*- coding: utf-8 -*-
*
* Starrater with a revised version from boucher from 280North
*/
@import <AppKit/CPControl.j>
@import <AppKit/CPImage.j>
var starEmpty = [[CPImage alloc] initWithContentsOfFile: "Resources/StarRater/empty.gif" size: CPSizeMake(25, 25)],
starSet = [[CPImage alloc] initWithContentsOfFile: "Resources/StarRater/set.gif" size: CPSizeMake(25, 25)],
#!/usr/bin/env ruby
require 'common'
require 'rake'
require 'rake/clean'
subprojects = %w{Objective-J Foundation AppKit Tools}
%w(build clean clobber).each do |task_name|
var context = [[CPGraphicsContext currentContext] graphicsPort],
bottomBorderColor = [CPColor colorWithWhite:0.0 alpha:0.6],
topBorderColor = [CPColor colorWithWhite:1.0 alpha:0.6],
tintColor = _tintColor || [self backgroundColor],
bounds = [self bounds];
CGContextSetFillColor(context, tintColor);
CGContextFillRect(context, bounds);
CGContextBeginPath(context);