Skip to content

Commit

Permalink
adding in 0.8.1 source for autocompletion
Browse files Browse the repository at this point in the history
  • Loading branch information
malkomalko committed May 14, 2010
1 parent 2edbbdd commit ddfc0cf
Show file tree
Hide file tree
Showing 181 changed files with 68,757 additions and 0 deletions.
169 changes: 169 additions & 0 deletions Support/source/AppController.j
@@ -0,0 +1,169 @@
/*
* AppController.j
*
* Created by __Me__ on __Date__.
* Copyright 2008 __MyCompanyName__. All rights reserved.
*/

@import <Foundation/CPObject.j>
@import <AppKit/_CPCibCustomResource.j>


@implementation AppController : CPObject
{
}

- (CPArray)themeNames
{
return ["Default"];
}

- (void)viewsForDefaultTheme
{
var views = [],
bundle = [CPBundle mainBundle];

// Horizontal Slider

var horizontalTrackColor = [CPColor colorWithPatternImage:[[CPThreePartImage alloc] initWithImageSlices:
[
[_CPCibCustomResource imageResourceWithName:"horizontal-track-left.png" size:CPSizeMake(2.0, 4.0)],
[_CPCibCustomResource imageResourceWithName:"horizontal-track-center.png" size:CPSizeMake(1.0, 4.0)],
[_CPCibCustomResource imageResourceWithName:"horizontal-track-right.png" size:CPSizeMake(2.0, 4.0)]
]
isVertical:NO]];

var horizontalSlider = [[CPSlider alloc] initWithFrame:CGRectMake(0.0, 0.0, 50.0, 24.0)];

[horizontalSlider setTrackWidth:4.0];
[horizontalSlider setHorizontalTrackColor:horizontalTrackColor];

var knobColor = [CPColor colorWithPatternImage:[_CPCibCustomResource imageResourceWithName:"knob.png" size:CPSizeMake(11.0, 11.0)]];
knobHighlightedColor = [CPColor colorWithPatternImage:[_CPCibCustomResource imageResourceWithName:"knob-highlighted.png" size:CPSizeMake(12.0, 12.0)]];

[horizontalSlider setKnobSize:CGSizeMake(12.0, 12.0)];
[horizontalSlider setKnobColor:knobColor];
[horizontalSlider setKnobColor:knobHighlightedColor forControlState:CPControlStateHighlighted];

views.push(horizontalSlider);

// Vertical Slider

var verticalTrackColor = [CPColor colorWithPatternImage:[[CPThreePartImage alloc] initWithImageSlices:
[
[_CPCibCustomResource imageResourceWithName:"vertical-track-top.png" size:CPSizeMake(4.0, 2.0)],
[_CPCibCustomResource imageResourceWithName:"vertical-track-center.png" size:CPSizeMake(4.0, 1.0)],
[_CPCibCustomResource imageResourceWithName:"vertical-track-bottom.png" size:CPSizeMake(4.0, 2.0)]
]
isVertical:YES]];

var verticalSlider = [[CPSlider alloc] initWithFrame:CGRectMake(0.0, 0.0, 24.0, 50.0)];

[verticalSlider setTrackWidth:4];
[verticalSlider setVerticalTrackColor:verticalTrackColor];

[verticalSlider setKnobSize:CGSizeMake(12.0, 12.0)];
[verticalSlider setKnobColor:knobColor];
[verticalSlider setKnobColor:knobHighlightedColor forControlState:CPControlStateHighlighted];

views.push(verticalSlider);

return views;
}

- (void)applicationDidFinishLaunching:(CPNotification)aNotification
{
var theWindow = [[CPWindow alloc] initWithContentRect:CGRectMakeZero() styleMask:CPBorderlessBridgeWindowMask],
contentView = [theWindow contentView],
bounds = [contentView bounds],
themeNames = [self themeNames],
index = 0,
count = themeNames.length;

var tabView = [[CPTabView alloc] initWithFrame:bounds];

[tabView setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable];

[contentView addSubview:tabView];

for (; index < count; ++index)
{
var item = [[CPTabViewItem alloc] initWithIdentifier:themeNames[index]],
selectorName = "viewsFor" + themeNames[index] + "Theme",
views = [self performSelector:selectorName],
viewsCount = [views count],
itemSize = CGSizeMake(0.0, 0.0);

while (viewsCount--)
{
var size = [views[viewsCount] frame].size;

if (size.width > itemSize.width)
itemSize.width = size.width;

if (size.height > itemSize.height)
itemSize.height = size.height;
}

itemSize.height += 30;
itemSize.width += 40;

var collectionView = [[CPCollectionView alloc] initWithFrame:CGRectMakeZero()],
collectionViewItem = [[CPCollectionViewItem alloc] init];

[collectionViewItem setView:[[ThemedView alloc] init]];

[collectionView setItemPrototype:collectionViewItem];
[collectionView setMinItemSize:itemSize];
[collectionView setMaxItemSize:itemSize];
[collectionView setVerticalMargin:5.0];
[collectionView setContent:views];

[item setLabel:themeNames[index]];
[item setView:collectionView];

[tabView addTabViewItem:item];
}

[theWindow orderFront:self];
}

@end

@implementation ThemedView : CPView
{
CPView _view;
CPTextField _label;
}

- (void)setRepresentedObject:(id)anObject
{
if (!_label)
{
_label = [[CPTextField alloc] initWithFrame:CGRectMakeZero()];

[_label setAlignment:CPCenterTextAlignment];
[_label setAutoresizingMask:CPViewMinYMargin | CPViewWidthSizable];
[_label setFont:[CPFont boldSystemFontOfSize:12.0]];

[self addSubview:_label];
}

[_label setStringValue:[anObject className]];
[_label sizeToFit];

[_label setFrame:CGRectMake(0.0, CGRectGetHeight([self bounds]) - CGRectGetHeight([_label frame]),
CGRectGetWidth([self bounds]), CGRectGetHeight([_label frame]))];

if (_view)
[_view removeFromSuperview];

_view = anObject;

[_view setAutoresizingMask:CPViewMinXMargin | CPViewMaxXMargin | CPViewMinYMargin | CPViewMaxYMargin];
[_view setFrameOrigin:CGPointMake((CGRectGetWidth([self bounds]) - CGRectGetWidth([_view frame])) / 2.0, (CGRectGetMinY([_label frame]) - CGRectGetHeight([_view frame])) / 2.0)];

[self addSubview:_view];
}

@end
87 changes: 87 additions & 0 deletions Support/source/AppKit.j
@@ -0,0 +1,87 @@
/*
* AppKit.j
* AppKit
*
* Created by Francisco Tolmasky.
* Copyright 2008, 280 North, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/

@import "CALayer.j"
@import "CPAlert.j"
@import "CPAnimation.j"
@import "CPApplication.j"
@import "CPBezierPath.j"
@import "CPBox.j"
@import "CPButton.j"
@import "CPButtonBar.j"
@import "CPCheckBox.j"
@import "CPCib.j"
@import "CPCibConnector.j"
@import "CPCibControlConnector.j"
@import "CPCibLoading.j"
@import "CPCibOutletConnector.j"
@import "CPClipView.j"
@import "CPCollectionViewItem.j"
@import "CPCollectionView.j"
@import "CPColor.j"
@import "CPColorPanel.j"
@import "CPColorWell.j"
@import "CPCompatibility.j"
@import "CPControl.j"
@import "CPCookie.j"
@import "CPCursor.j"
@import "CPDocument.j"
@import "CPDocumentController.j"
@import "CPEvent.j"
@import "CPFlashMovie.j"
@import "CPFlashView.j"
@import "CPFont.j"
@import "CPFontManager.j"
@import "CPGeometry.j"
@import "CPImage.j"
@import "CPImageView.j"
@import "CPMenu.j"
@import "CPMenuItem.j"
@import "CPOpenPanel.j"
@import "CPOutlineView.j"
@import "CPPanel.j"
@import "CPPasteboard.j"
@import "CPPopUpButton.j"
@import "CPProgressIndicator.j"
@import "CPRadio.j"
@import "CPResponder.j"
@import "CPSearchField.j"
@import "CPScrollView.j"
@import "CPScroller.j"
@import "CPSecureTextField.j"
@import "CPSegmentedControl.j"
@import "CPShadow.j"
@import "CPSlider.j"
@import "CPSplitView.j"
@import "CPTabView.j"
@import "CPTableColumn.j"
@import "CPTableView.j"
@import "CPTextField.j"
@import "CPToolbar.j"
@import "CPToolbarItem.j"
@import "CPTreeNode.j"
@import "CPView.j"
@import "CPViewAnimation.j"
@import "CPViewController.j"
@import "CPWebView.j"
@import "CPWindow.j"
@import "CPWindowController.j"

0 comments on commit ddfc0cf

Please sign in to comment.