Skip to content

Instantly share code, notes, and snippets.

function main(args, namedArgs)
{
// FIXME: This code should be in Objective-J.
var args = window.location.hash.replace("#", "").split("/").slice(0),
searchParams = window.location.search.substring(1).split("&");
namedArgs = [CPDictionary dictionary];
for(var i=0, count = args.length; i<count; i++)
args[i] = decodeURIComponent(args[i]);
@boucher
boucher / gist:9714
Created September 9, 2008 17:28
checkbox
var checkboxImage,
checkboxAlternateImage,
checkboxCheckedImage,
checkboxCheckedAlternateImage;
@implementation CheckboxButton : CPButton
{
BOOL _isChecked;
}
var NSConstantValueExpressionType = 1 << 0,
NSEvaluatedObjectExpressionType = 1 << 1,
NSVariableExpressionType = 1 << 2,
NSKeyPathExpressionType = 1 << 3,
NSFunctionExpressionType = 1 << 4;
diff --git a/AppKit/CPTextField.j b/AppKit/CPTextField.j
index f1ba2d3..d3938d7 100644
--- a/AppKit/CPTextField.j
+++ b/AppKit/CPTextField.j
@@ -97,15 +97,17 @@ var _CPTextFieldSquareBezelColor = nil;
*/
@implementation CPTextField : CPControl
{
+ id _delegate;
+
- (void)drawInContext:(CGContext)aContext
{
var bounds = CGRectInset([self bounds], 5.0, 5.0),
theClass = [self class];
bounds.origin.x -= 1.0;
if(TransformControlNeedsManualShadow)
{
CGContextSetStrokeColor(aContext, [theClass shadowColor]);
diff --git a/AppKit/CPTextField.j b/AppKit/CPTextField.j
index 2737de9..6e2c32d 100644
--- a/AppKit/CPTextField.j
+++ b/AppKit/CPTextField.j
@@ -468,7 +468,8 @@ var _CPTextFieldSquareBezelColor = nil;
var CPTextFieldIsSelectableKey = @"CPTextFieldIsSelectableKey",
CPTextFieldLineBreakModeKey = @"CPTextFieldLineBreakModeKey",
- CPTextFieldStringValueKey = @"CPTextFieldStringValueKey";
+ CPTextFieldStringValueKey = @"CPTextFieldStringValueKey",
//
// FileUpload.j
// Editor
//
// Created by Francisco Tolmasky on 03/04/08.
// Copyright 2005 - 2008, 280 North, Inc. All rights reserved.
//
import <Foundation/CPObject.j>
import <Foundation/CPValue.j>
- (void)_replaceSetters
{
var rootClass = [_targetObject class],
currentClass = rootClass;
while (currentClass && currentClass != currentClass.super_class)
{
var methodList = currentClass.method_list,
count = methodList.length;
- (void) notifyForKey: (NSString *)aKey ofInstance: (id)instance prior: (BOOL)f
{
unsigned count;
id oldValue;
id newValue;
if (f == YES)
{
if ((allOptions & NSKeyValueObservingOptionPrior) == 0)
{
setTimeout(function()
{
//objective j code here
}, 100);