Skip to content

Instantly share code, notes, and snippets.

@implementation ImageLoaderWorker : CPObject
{
CPImageView m_imageView;
CPImage m_image;
}
- (id)initWithUrl:(CPString)urlStr
imageView:(CPImageView)anImageView
{
self = [super init];
@gorenje
gorenje / gist:865994
Created March 11, 2011 15:14
cib data caching based on urls. This is simplest case, no loadDelegate is supported.
/*
* Store all CIB data on a url-data basis in this dictionary. To prevent cibs from
* being continously downloaded by the CPWindowController, or rather the CPCib, we
* override the responsible init method and cache the data.
*/
CibDataCacheDictionary = [CPDictionary dictionary];
@implementation CPCib (CacheDataResponse)
/*
@gorenje
gorenje / CALayerFixed.j
Created March 22, 2011 13:44
workaround for #1183
/**************************
c_a_layer_fixed.j
**************************/
@implementation CALayerFixed : CALayer
- (void)composite
{
var originalTransform = CGAffineTransformCreateCopy(_transformFromLayer);
[super composite];
@implementation TNToolTip (WithTimer)
+ (TNToolTip)toolTipWithString:(CPString)aString
forView:(CPView)aView
closeAfter:(float)aSecondsValue
{
var tooltip = [TNToolTip toolTipWithString:aString forView:aView];
var stopInvoker = [[CPInvocation alloc] initWithMethodSignature:nil];
[stopInvoker setTarget:tooltip];
@import <Foundation/CPObject.j>
@import "UserSessionController.j"
@implementation AppController : CPObject
{
CPWindow mainWindow; //this "outlet" is connected automatically by the Cib
CPMenu mainMenu;
CPView contentView;
CPToolbar toolbar;
@gorenje
gorenje / gist:883074
Created March 23, 2011 13:18
pop up windows with cibs
/************
Window controllers, gets loaded via a CIB
*************/
@implementation GoogleImagesController : CPWindowController
{
@outlet CPCollectionView m_photoView;
@outlet CPTextField m_searchTerm;
@outlet CPImageView m_spinnerImage;
@outlet CPScrollView m_scrollView;
@outlet CPTextField m_indexField;
@gorenje
gorenje / gist:883961
Created March 23, 2011 20:59
tooltips for toolbaritems
@implementation _CPToolbarItemView (MouseEntered)
- (void)mouseEntered:(CPEvent)anEvent
{
// TODO add code to check whether super responses to this method.
if ( [_toolbarItem toolTip] ) {
[TNToolTip toolTipWithString:[_toolbarItem toolTip]
forView:([_labelField stringValue] === @"" ? _imageView :
_labelField)
closeAfter:2.5];
@gorenje
gorenje / gist:883996
Created March 23, 2011 21:12
using tntooltip with timer
@implementation TNToolTip (WithTimer)
+ (TNToolTip)toolTipWithString:(CPString)aString
forView:(CPView)aView
closeAfter:(float)aSecondsValue
{
var tooltip = [TNToolTip toolTipWithString:aString forView:aView];
var stopInvoker = [[CPInvocation alloc] initWithMethodSignature:nil];
[stopInvoker setTarget:tooltip];
function obtainXibs()
{
var xibs = FILE.glob("Xibs/*.xib");
for ( var idx = 0 ; idx < xibs.length; idx++ ) {
xibs[idx] = xibs[idx].substring(0, xibs[idx].length - 4).substring(5);
}
return xibs;
}
@gorenje
gorenje / gist:936991
Created April 22, 2011 16:28
installing a local version of cappuccino for testing a new version of cappuccino
## create directory for a new install of narwhal
mkdir ~/tmp
cd ~/tmp
git clone git://github.com/280north/narwhal.git
cd narwhal/
## add the new narwhal to the front of the path
export PATH=$(pwd)/bin:$PATH
## install necessary tools for building cappuccino