Merge pull request #1601 from slevenbits/CPComboBox

CPComboBox and CPTextField enhancements

- Full Cocoa-compliant implementation of CPComboBox and CPComboBoxDelegate.

- Better focus ring for CPTextField and all subclasses.

- CPTextField and its subclasses draw disabled contents differently, per Cocoa.
This commit is contained in:
aparajita
2012-07-06 13:24:01 -07:00
83 changed files with 4252 additions and 81 deletions
+1
View File
@@ -47,6 +47,7 @@
@import "CPColorPanel.j"
@import "CPColorSpace.j"
@import "CPColorWell.j"
@import "CPComboBox.j"
@import "CPCompatibility.j"
@import "CPControl.j"
@import "CPController.j"
+1193
View File
File diff suppressed because it is too large Load Diff
+2
View File
@@ -558,6 +558,8 @@ CPValueBinding = @"value";
CPValueURLBinding = @"valueURL";
CPValuePathBinding = @"valuePath";
CPDataBinding = @"data";
CPContentBinding = @"content";
CPContentValuesBinding = @"contentValues";
//Binding options constants
CPAllowsEditingMultipleValuesSelectionBindingOption = @"CPAllowsEditingMultipleValuesSelection";
+8 -14
View File
@@ -486,10 +486,8 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
#if PLATFORM(DOM)
var element = [self _inputElement],
font = [self currentValueForThemeAttribute:@"font"];
// generate the font metric
[font _getMetrics];
font = [self currentValueForThemeAttribute:@"font"],
lineHeight = ROUND([font defaultLineHeightForFont]);
element.value = _stringValue;
element.style.color = [[self currentValueForThemeAttribute:@"text-color"] cssString];
@@ -511,26 +509,26 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
switch (verticalAlign)
{
case CPTopVerticalTextAlignment:
var topPoint = (_CGRectGetMinY(contentRect) + 1) + "px"; // for the same reason we have a -1 for the left, we also have a + 1 here
var topPoint = _CGRectGetMinY(contentRect) + "px";
break;
case CPCenterVerticalTextAlignment:
var topPoint = (_CGRectGetMidY(contentRect) - (font._lineHeight / 2) + 1) + "px";
var topPoint = (_CGRectGetMidY(contentRect) - (lineHeight / 2)) + "px";
break;
case CPBottomVerticalTextAlignment:
var topPoint = (_CGRectGetMaxY(contentRect) - font._lineHeight) + "px";
var topPoint = (_CGRectGetMaxY(contentRect) - lineHeight) + "px";
break;
default:
var topPoint = (_CGRectGetMinY(contentRect) + 1) + "px";
var topPoint = _CGRectGetMinY(contentRect) + "px";
break;
}
element.style.top = topPoint;
element.style.left = (_CGRectGetMinX(contentRect) - 1) + "px"; // why -1?
element.style.left = (_CGRectGetMinX(contentRect) - 1) + "px"; // -1 because input element seems to have 1px left inset
element.style.width = _CGRectGetWidth(contentRect) + "px";
element.style.height = font._lineHeight + "px"; // private ivar for the line height of the DOM text at this particular size
element.style.height = lineHeight + "px";
_DOMElement.appendChild(element);
@@ -1315,9 +1313,6 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
{
var contentInset = [self currentValueForThemeAttribute:@"content-inset"];
if (!contentInset)
return bounds;
bounds.origin.x += contentInset.left;
bounds.origin.y += contentInset.top;
bounds.size.width -= contentInset.left + contentInset.right;
@@ -1365,7 +1360,6 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
else
{
var view = [[_CPImageAndTextView alloc] initWithFrame:_CGRectMakeZero()];
//[view setImagePosition:CPNoImage];
[view setHitTests:NO];
+35 -8
View File
@@ -90,6 +90,11 @@ var CPScrollDestinationNone = 0,
return "tokenfield";
}
+ (id)themeAttributes
{
return [CPDictionary dictionaryWithObject:_CGInsetMakeZero() forKey:@"editor-inset"];
}
- (id)initWithFrame:(CPRect)frame
{
if (self = [super initWithFrame:frame])
@@ -179,6 +184,7 @@ var CPScrollDestinationNone = 0,
// Give the delegate a chance to confirm, replace or add to the list of tokens being added.
var delegateApprovedObjects = [self _shouldAddObjects:[CPArray arrayWithObject:token] atIndex:_selectedRange.location],
delegateApprovedObjectsCount = [delegateApprovedObjects count];
if (delegateApprovedObjects)
{
for (var i = 0; i < delegateApprovedObjectsCount; i++)
@@ -313,11 +319,12 @@ var CPScrollDestinationNone = 0,
#if PLATFORM(DOM)
var string = [self stringValue],
element = [self _inputElement];
element = [self _inputElement],
font = [self currentValueForThemeAttribute:@"font"];
element.value = nil;
element.style.color = [[self currentValueForThemeAttribute:@"text-color"] cssString];
element.style.font = [[self currentValueForThemeAttribute:@"font"] cssString];
element.style.font = [font cssString];
element.style.zIndex = 1000;
switch ([self alignment])
@@ -332,9 +339,9 @@ var CPScrollDestinationNone = 0,
var contentRect = [self contentRectForBounds:[self bounds]];
element.style.top = CGRectGetMinY(contentRect) + "px";
element.style.left = (CGRectGetMinX(contentRect) - 1) + "px"; // why -1?
element.style.left = (CGRectGetMinX(contentRect) - 1) + "px"; // <input> element effectively imposes a 1px left margin
element.style.width = CGRectGetWidth(contentRect) + "px";
element.style.height = CGRectGetHeight(contentRect) + "px";
element.style.height = ROUND([font defaultLineHeightForFont]) + "px";
[_tokenScrollView documentView]._DOMElement.appendChild(element);
@@ -472,6 +479,7 @@ var CPScrollDestinationNone = 0,
- (id)objectValue
{
var objectValue = [];
for (var i = 0, count = [[self _tokens] count]; i < count; i++)
{
var token = [[self _tokens] objectAtIndex:i];
@@ -570,6 +578,20 @@ var CPScrollDestinationNone = 0,
[self setNeedsDisplay:YES];
}
- (void)setEnabled:(BOOL)shouldBeEnabled
{
[super setEnabled:shouldBeEnabled];
// Set the enabled state of the tokens
for (var i = 0, count = [[self _tokens] count]; i < count; i++)
{
var token = [[self _tokens] objectAtIndex:i];
if ([token respondsToSelector:@selector(setEnabled:)])
[token setEnabled:shouldBeEnabled];
}
}
- (void)sendAction:(SEL)anAction to:(id)anObject
{
_shouldNotifyTarget = NO;
@@ -962,7 +984,10 @@ var CPScrollDestinationNone = 0,
offset = CPPointMake(contentOrigin.x, contentOrigin.y),
spaceBetweenTokens = CPSizeMake(2.0, 2.0),
isEditing = [[self window] firstResponder] == self,
tokenToken = [_CPTokenFieldToken new];
tokenToken = [_CPTokenFieldToken new],
font = [self currentValueForThemeAttribute:@"font"],
lineHeight = ROUND([font defaultLineHeightForFont]),
editorInset = [self currentValueForThemeAttribute:@"editor-inset"];
// Get the height of a typical token, or a token token if you will.
[tokenToken sizeToFit];
@@ -1001,15 +1026,17 @@ var CPScrollDestinationNone = 0,
// XXX The "X" here is used to estimate the space needed to fit the next character
// without clipping. Since different fonts might have different sizes of "X" this
// solution is not ideal, but it works.
textWidth = [(element.value || @"") + "X" sizeWithFont:[self font]].width;
textWidth = [(element.value || @"") + "X" sizeWithFont:font].width;
if (useRemainingWidth)
textWidth = MAX(contentSize.width - offset.x - 1, textWidth);
}
_inputFrame = fitAndFrame(textWidth, tokenHeight);
_inputFrame.size.height = lineHeight;
element.style.left = _inputFrame.origin.x + "px";
element.style.top = _inputFrame.origin.y + "px";
element.style.left = (_inputFrame.origin.x + editorInset.left) + "px";
element.style.top = (_inputFrame.origin.y + editorInset.top) + "px";
element.style.width = _inputFrame.size.width + "px";
element.style.height = _inputFrame.size.height + "px";
Binary file not shown.

After

Width:  |  Height:  |  Size: 145 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 139 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 196 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 487 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 162 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 383 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 700 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 209 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 141 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 141 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 211 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 392 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 162 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 373 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 615 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 220 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 413 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 527 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 123 B

After

Width:  |  Height:  |  Size: 141 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 141 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 436 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 473 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 149 B

After

Width:  |  Height:  |  Size: 165 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 757 B

After

Width:  |  Height:  |  Size: 837 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 735 B

After

Width:  |  Height:  |  Size: 910 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 559 B

After

Width:  |  Height:  |  Size: 451 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 531 B

After

Width:  |  Height:  |  Size: 501 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 155 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1004 B

After

Width:  |  Height:  |  Size: 129 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 161 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 994 B

After

Width:  |  Height:  |  Size: 117 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 991 B

After

Width:  |  Height:  |  Size: 109 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 994 B

After

Width:  |  Height:  |  Size: 115 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 160 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 997 B

After

Width:  |  Height:  |  Size: 124 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 161 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 155 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1004 B

After

Width:  |  Height:  |  Size: 129 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 167 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 994 B

After

Width:  |  Height:  |  Size: 117 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 991 B

After

Width:  |  Height:  |  Size: 109 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 994 B

After

Width:  |  Height:  |  Size: 115 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 153 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 997 B

After

Width:  |  Height:  |  Size: 124 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 157 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 216 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1012 B

After

Width:  |  Height:  |  Size: 134 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 231 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1012 B

After

Width:  |  Height:  |  Size: 130 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 991 B

After

Width:  |  Height:  |  Size: 109 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1009 B

After

Width:  |  Height:  |  Size: 129 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 229 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1007 B

After

Width:  |  Height:  |  Size: 134 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 218 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 153 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 477 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 498 B

+171 -59
View File
@@ -863,46 +863,46 @@ var themedButtonValues = nil,
bezelColor = PatternColor(
[
["textfield-bezel-square-0.png", 3.0, 4.0],
["textfield-bezel-square-1.png", 1.0, 4.0],
["textfield-bezel-square-2.png", 3.0, 4.0],
["textfield-bezel-square-3.png", 3.0, 1.0],
["textfield-bezel-square-0.png", 6.0, 6.0],
["textfield-bezel-square-1.png", 1.0, 6.0],
["textfield-bezel-square-2.png", 6.0, 6.0],
["textfield-bezel-square-3.png", 6.0, 1.0],
["textfield-bezel-square-4.png", 1.0, 1.0],
["textfield-bezel-square-5.png", 3.0, 1.0],
["textfield-bezel-square-6.png", 3.0, 4.0],
["textfield-bezel-square-7.png", 1.0, 4.0],
["textfield-bezel-square-8.png", 3.0, 4.0]
["textfield-bezel-square-5.png", 6.0, 1.0],
["textfield-bezel-square-6.png", 6.0, 6.0],
["textfield-bezel-square-7.png", 1.0, 6.0],
["textfield-bezel-square-8.png", 6.0, 6.0]
]),
bezelFocusedColor = PatternColor(
[
["textfield-bezel-square-focused-0.png", 7.0, 7.0],
["textfield-bezel-square-focused-1.png", 1.0, 7.0],
["textfield-bezel-square-focused-2.png", 7.0, 7.0],
["textfield-bezel-square-focused-3.png", 7.0, 1.0],
["textfield-bezel-square-focused-0.png", 6.0, 6.0],
["textfield-bezel-square-focused-1.png", 1.0, 6.0],
["textfield-bezel-square-focused-2.png", 6.0, 6.0],
["textfield-bezel-square-focused-3.png", 6.0, 1.0],
["textfield-bezel-square-focused-4.png", 1.0, 1.0],
["textfield-bezel-square-focused-5.png", 7.0, 1.0],
["textfield-bezel-square-focused-6.png", 7.0, 7.0],
["textfield-bezel-square-focused-7.png", 1.0, 7.0],
["textfield-bezel-square-focused-8.png", 7.0, 7.0]
["textfield-bezel-square-focused-5.png", 6.0, 1.0],
["textfield-bezel-square-focused-6.png", 6.0, 6.0],
["textfield-bezel-square-focused-7.png", 1.0, 6.0],
["textfield-bezel-square-focused-8.png", 6.0, 6.0]
]),
bezelDisabledColor = PatternColor(
[
["textfield-bezel-square-disabled-0.png", 3.0, 4.0],
["textfield-bezel-square-disabled-1.png", 1.0, 4.0],
["textfield-bezel-square-disabled-2.png", 3.0, 4.0],
["textfield-bezel-square-disabled-3.png", 3.0, 1.0],
["textfield-bezel-square-disabled-0.png", 6.0, 6.0],
["textfield-bezel-square-disabled-1.png", 1.0, 6.0],
["textfield-bezel-square-disabled-2.png", 6.0, 6.0],
["textfield-bezel-square-disabled-3.png", 6.0, 1.0],
["textfield-bezel-square-disabled-4.png", 1.0, 1.0],
["textfield-bezel-square-disabled-5.png", 3.0, 1.0],
["textfield-bezel-square-disabled-6.png", 3.0, 4.0],
["textfield-bezel-square-disabled-7.png", 1.0, 4.0],
["textfield-bezel-square-disabled-8.png", 3.0, 4.0]
]),
["textfield-bezel-square-disabled-5.png", 6.0, 1.0],
["textfield-bezel-square-disabled-6.png", 6.0, 6.0],
["textfield-bezel-square-disabled-7.png", 1.0, 6.0],
["textfield-bezel-square-disabled-8.png", 6.0, 6.0]
]);
placeholderColor = [CPColor colorWithCalibratedRed:189.0 / 255.0 green:199.0 / 255.0 blue:211.0 / 255.0 alpha:1.0];
// Global for reuse by CPTokenField.
// Global for reuse by subclasses
textDisabledColor = [CPColor colorWithCalibratedWhite:0.60 alpha:1.0];
placeholderColor = [CPColor colorWithCalibratedRed:189.0 / 255.0 green:199.0 / 255.0 blue:211.0 / 255.0 alpha:1.0];
themedTextFieldValues =
[
[@"vertical-alignment", CPTopVerticalTextAlignment, CPThemeStateBezeled],
@@ -911,30 +911,35 @@ var themedButtonValues = nil,
[@"bezel-color", bezelDisabledColor, CPThemeStateBezeled | CPThemeStateDisabled],
[@"font", [CPFont systemFontOfSize:12.0], CPThemeStateBezeled],
[@"content-inset", CGInsetMake(8.0, 7.0, 5.0, 8.0), CPThemeStateBezeled],
[@"content-inset", CGInsetMake(7.0, 7.0, 5.0, 8.0), CPThemeStateBezeled | CPThemeStateEditing],
[@"bezel-inset", CGInsetMake(3.0, 4.0, 3.0, 4.0), CPThemeStateBezeled],
[@"bezel-inset", CGInsetMake(0.0, 0.0, 0.0, 0.0), CPThemeStateBezeled | CPThemeStateEditing],
// no border
[@"bezel-inset", CGInsetMakeZero()],
[@"content-inset", CGInsetMake(2.0, 2.0, 2.0, 2.0)], // as defined in [CPTextField +themeAttributes]
// with border
[@"bezel-inset", CGInsetMakeZero(), CPThemeStateBezeled],
[@"content-inset", CGInsetMake(8.0, 7.0, 7.0, 8.0), CPThemeStateBezeled],
[@"text-color", textDisabledColor, CPThemeStateBezeled | CPThemeStateDisabled],
[@"text-color", placeholderColor, CPTextFieldStatePlaceholder],
[@"text-color", placeholderColor, CPTextFieldStatePlaceholder | CPThemeStateDisabled],
[@"line-break-mode", CPLineBreakByTruncatingTail, CPThemeStateTableDataView],
[@"vertical-alignment", CPCenterVerticalTextAlignment, CPThemeStateTableDataView],
[@"content-inset", CGInsetMake(0.0, 0.0, 0.0, 5.0), CPThemeStateTableDataView],
[@"content-inset", CGInsetMake(3.0, 3.0, 3.0, 5.0), CPThemeStateTableDataView],
[@"text-color", [CPColor colorWithCalibratedWhite:51.0 / 255.0 alpha:1.0], CPThemeStateTableDataView],
[@"text-color", [CPColor whiteColor], CPThemeStateTableDataView | CPThemeStateSelectedTableDataView],
[@"font", [CPFont boldSystemFontOfSize:12.0], CPThemeStateTableDataView | CPThemeStateSelectedTableDataView],
[@"text-color", [CPColor blackColor], CPThemeStateTableDataView | CPThemeStateEditing],
[@"content-inset", CGInsetMake(7.0, 7.0, 5.0, 8.0), CPThemeStateTableDataView | CPThemeStateEditing],
[@"content-inset", CGInsetMake(8.0, 8.0, 7.0, 5.0), CPThemeStateTableDataView | CPThemeStateEditing],
[@"font", [CPFont systemFontOfSize:12.0], CPThemeStateTableDataView | CPThemeStateEditing],
[@"bezel-inset", CGInsetMake(-2.0, -2.0, -2.0, -2.0), CPThemeStateTableDataView | CPThemeStateEditing],
[@"bezel-inset", CGInsetMake(-1.0, -1.0, -1.0, -1.0), CPThemeStateTableDataView | CPThemeStateEditing],
[@"text-color", [CPColor colorWithCalibratedWhite:125.0 / 255.0 alpha:1.0], CPThemeStateTableDataView | CPThemeStateGroupRow],
[@"text-color", [CPColor colorWithCalibratedWhite:1.0 alpha:1.0], CPThemeStateTableDataView | CPThemeStateGroupRow | CPThemeStateSelectedTableDataView],
[@"text-shadow-color", [CPColor whiteColor], CPThemeStateTableDataView | CPThemeStateGroupRow],
[@"text-shadow-offset", CGSizeMake(0,1), CPThemeStateTableDataView | CPThemeStateGroupRow],
[@"text-shadow-color", [CPColor colorWithCalibratedWhite:0.0 alpha:0.6], CPThemeStateTableDataView | CPThemeStateGroupRow | CPThemeStateSelectedTableDataView],
[@"text-shadow-color", [CPColor colorWithCalibratedWhite:0.0 alpha:0.6], CPThemeStateTableDataView | CPThemeStateGroupRow | CPThemeStateSelectedTableDataView],
[@"font", [CPFont boldSystemFontOfSize:12.0], CPThemeStateTableDataView | CPThemeStateGroupRow]
];
@@ -954,35 +959,42 @@ var themedButtonValues = nil,
var textfield = [[CPTextField alloc] initWithFrame:CGRectMake(0.0, 0.0, 60.0, 30.0)],
bezelColor = PatternColor(
[
["textfield-bezel-rounded-left.png", 13.0, 22.0],
["textfield-bezel-rounded-center.png", 1.0, 22.0],
["textfield-bezel-rounded-right.png", 13.0, 22.0]
["textfield-bezel-rounded-left.png", 15.0, 30.0],
["textfield-bezel-rounded-center.png", 1.0, 30.0],
["textfield-bezel-rounded-right.png", 15.0, 30.0]
],
PatternIsHorizontal),
bezelFocusedColor = PatternColor(
[
["textfield-bezel-rounded-focused-left.png", 17.0, 30.0],
["textfield-bezel-rounded-focused-left.png", 15.0, 30.0],
["textfield-bezel-rounded-focused-center.png", 1.0, 30.0],
["textfield-bezel-rounded-focused-right.png", 17.0, 30.0]
["textfield-bezel-rounded-focused-right.png", 15.0, 30.0]
],
PatternIsHorizontal),
placeholderColor = [CPColor colorWithCalibratedRed:189.0 / 255.0 green:199.0 / 255.0 blue:211.0 / 255.0 alpha:1.0];
bezelDisabledColor = PatternColor(
[
["textfield-bezel-rounded-disabled-left.png", 15.0, 30.0],
["textfield-bezel-rounded-disabled-center.png", 1.0, 30.0],
["textfield-bezel-rounded-disabled-right.png", 15.0, 30.0]
],
PatternIsHorizontal);
// Global for reuse by CPSearchField
// Global for reuse by subclasses
themedRoundedTextFieldValues =
[
[@"bezel-color", bezelColor, CPTextFieldStateRounded | CPThemeStateBezeled],
[@"bezel-color", bezelFocusedColor, CPTextFieldStateRounded | CPThemeStateBezeled | CPThemeStateEditing],
[@"bezel-color", bezelColor, CPTextFieldStateRounded | CPThemeStateBezeled],
[@"bezel-color", bezelFocusedColor, CPTextFieldStateRounded | CPThemeStateBezeled | CPThemeStateEditing],
[@"bezel-color", bezelDisabledColor, CPTextFieldStateRounded | CPThemeStateBezeled | CPThemeStateDisabled],
[@"font", [CPFont systemFontOfSize:12.0]],
[@"content-inset", CGInsetMake(8.0, 14.0, 6.0, 14.0), CPTextFieldStateRounded | CPThemeStateBezeled],
[@"content-inset", CGInsetMake(7.0, 14.0, 6.0, 14.0), CPTextFieldStateRounded | CPThemeStateBezeled | CPThemeStateEditing],
[@"bezel-inset", CGInsetMake(4.0, 4.0, 4.0, 4.0), CPTextFieldStateRounded | CPThemeStateBezeled],
[@"bezel-inset", CGInsetMake(0.0, 0.0, 0.0, 0.0), CPTextFieldStateRounded | CPThemeStateBezeled | CPThemeStateEditing],
// The new bezel is one pixel shorter, so we add one extra empty pixel at the bottom
// for size compatibility with an earlier version.
[@"bezel-inset", CGInsetMake(0.0, 0.0, 1.0, 0.0), CPTextFieldStateRounded | CPThemeStateBezeled],
[@"content-inset", CGInsetMake(8.0, 13.0, 7.0, 14.0), CPTextFieldStateRounded | CPThemeStateBezeled],
[@"text-color", textDisabledColor, CPTextFieldStateRounded | CPThemeStateDisabled],
[@"text-color", placeholderColor, CPTextFieldStateRounded | CPTextFieldStatePlaceholder],
[@"min-size", CGSizeMake(0.0, 30.0), CPTextFieldStateRounded | CPThemeStateBezeled],
@@ -1015,11 +1027,20 @@ var themedButtonValues = nil,
overrides =
[
[@"content-inset", CGInsetMake(8.0, 0.0, 4.0, 0.0)],
// Placeholder is displayed as regular text, not tokens; requires a different inset.
[@"content-inset", CGInsetMake(9.0, 0.0, 5.0, 2.0), CPTextFieldStatePlaceholder],
[@"content-inset", CGInsetMake(6.0, 5.0, 5.0, 6.0), CPThemeStateBezeled],
[@"content-inset", CGInsetMake(9.0, 7.0, 6.0, 8.0), CPThemeStateBezeled | CPTextFieldStatePlaceholder],
[@"bezel-inset", CGInsetMakeZero()],
[@"editor-inset", CGInsetMake(2.0, 0.0, 0.0, 0.0)],
// Non-bezeled token field with tokens
[@"content-inset", CGInsetMake(5.0, 8.0, 4.0, 8.0)],
// Non-bezeled token field with no tokens
[@"content-inset", CGInsetMake(7.0, 8.0, 6.0, 8.0), CPTextFieldStatePlaceholder],
// Bezeled token field with tokens
[@"content-inset", CGInsetMake(6.0, 8.0, 2.0, 8.0), CPThemeStateBezeled],
// Bezeled token field with no tokens
[@"content-inset", CGInsetMake(8.0, 8.0, 7.0, 8.0), CPThemeStateBezeled | CPTextFieldStatePlaceholder]
];
[self registerThemeValues:overrides forView:tokenfield inherit:themedTextFieldValues];
@@ -1047,6 +1068,14 @@ var themedButtonValues = nil,
],
PatternIsHorizontal),
bezelColorDisabled = PatternColor(
[
["token-left-disabled.png", 11.0, 19.0],
["token-center-disabled.png", 1.0, 19.0],
["token-right-disabled.png", 11.0, 19.0]
],
PatternIsHorizontal),
textColor = [CPColor colorWithRed:41.0 / 255.0 green:51.0 / 255.0 blue:64.0 / 255.0 alpha:1.0],
textHighlightedColor = [CPColor whiteColor],
@@ -1054,18 +1083,19 @@ var themedButtonValues = nil,
[
[@"bezel-color", bezelColor, CPThemeStateBezeled],
[@"bezel-color", bezelHighlightedColor, CPThemeStateBezeled | CPThemeStateHighlighted],
[@"bezel-color", bezelColorDisabled, CPThemeStateBezeled | CPThemeStateDisabled],
[@"text-color", textColor],
[@"text-color", textHighlightedColor, CPThemeStateHighlighted],
[@"bezel-inset", CGInsetMake(0.0, 0.0, 0.0, 0.0), CPThemeStateBezeled],
[@"content-inset", CGInsetMake(1.0, 24.0, 2.0, 16.0), CPThemeStateBezeled],
[@"bezel-inset", CGInsetMakeZero(), CPThemeStateBezeled],
[@"content-inset", CGInsetMake(1.0, 22.0, 3.0, 15.0), CPThemeStateBezeled],
// Minimum height == maximum height since tokens are fixed height.
[@"min-size", CGSizeMake(0.0, 19.0)],
[@"max-size", CGSizeMake(-1.0, 19.0)],
[@"vertical-alignment", CPCenterTextAlignment],
[@"vertical-alignment", CPCenterTextAlignment]
];
[self registerThemeValues:themeValues forView:token];
@@ -1091,7 +1121,7 @@ var themedButtonValues = nil,
[@"bezel-inset", CGInsetMake(0.0, 0.0, 0.0, 0.0), CPThemeStateBordered],
[@"bezel-inset", CGInsetMake(0.0, 0.0, 0.0, 0.0), CPThemeStateBordered | CPThemeStateHighlighted],
[@"offset", CGPointMake(18, 6), CPThemeStateBordered]
[@"offset", CGPointMake(17, 6), CPThemeStateBordered]
];
[self registerThemeValues:themeValues forView:button];
@@ -1099,6 +1129,88 @@ var themedButtonValues = nil,
return button;
}
+ (CPComboBox)themedComboBox
{
var combo = [[CPComboBox alloc] initWithFrame:CGRectMake(0.0, 0.0, 100.0, 29.0)],
bezelColor = PatternColor(
[
["combobox-bezel-left.png", 6.0, 29.0],
["combobox-bezel-center.png", 1.0, 29.0],
["combobox-bezel-right.png", 24.0, 29.0]
],
PatternIsHorizontal),
bezelFocusedColor = PatternColor(
[
["combobox-bezel-focused-left.png", 6.0, 29.0],
["combobox-bezel-focused-center.png", 1.0, 29.0],
["combobox-bezel-focused-right.png", 24.0, 29.0]
],
PatternIsHorizontal),
bezelDisabledColor = PatternColor(
[
["combobox-bezel-disabled-left.png", 6.0, 29.0],
["combobox-bezel-disabled-center.png", 1.0, 29.0],
["combobox-bezel-disabled-right.png", 24.0, 29.0]
],
PatternIsHorizontal),
bezelNoBorderColor = PatternColor(
[
["combobox-bezel-no-border-left.png", 6.0, 29.0],
["combobox-bezel-no-border-center.png", 1.0, 29.0],
["combobox-bezel-no-border-right.png", 24.0, 29.0]
],
PatternIsHorizontal),
bezelNoBorderFocusedColor = PatternColor(
[
["combobox-bezel-no-border-focused-left.png", 6.0, 29.0],
["combobox-bezel-no-border-focused-center.png", 1.0, 29.0],
["combobox-bezel-no-border-focused-right.png", 24.0, 29.0]
],
PatternIsHorizontal),
bezelNoBorderDisabledColor = PatternColor(
[
["combobox-bezel-no-border-disabled-left.png", 6.0, 29.0],
["combobox-bezel-no-border-disabled-center.png", 1.0, 29.0],
["combobox-bezel-no-border-disabled-right.png", 24.0, 29.0]
],
PatternIsHorizontal),
overrides =
[
[@"bezel-color", bezelColor, CPThemeStateBezeled | CPComboBoxStateButtonBordered],
[@"bezel-color", bezelFocusedColor, CPThemeStateBezeled | CPComboBoxStateButtonBordered | CPThemeStateEditing],
[@"bezel-color", bezelDisabledColor, CPThemeStateBezeled | CPComboBoxStateButtonBordered | CPThemeStateDisabled],
[@"bezel-color", bezelNoBorderColor, CPThemeStateBezeled],
[@"bezel-color", bezelNoBorderFocusedColor, CPThemeStateBezeled | CPThemeStateEditing],
[@"bezel-color", bezelNoBorderDisabledColor, CPThemeStateBezeled | CPThemeStateDisabled],
[@"border-inset", CGInsetMake(3.0, 3.0, 3.0, 3.0), CPThemeStateBezeled],
// The right border inset has to make room for the focus ring and popup button
[@"content-inset", CGInsetMake(8.0, 27.0, 7.0, 8.0), CPThemeStateBezeled | CPComboBoxStateButtonBordered],
[@"content-inset", CGInsetMake(8.0, 24.0, 7.0, 8.0), CPThemeStateBezeled],
[@"content-inset", CGInsetMake(8.0, 24.0, 7.0, 8.0), CPThemeStateBezeled | CPThemeStateEditing],
[@"popup-button-size", CGSizeMake(21.0, 23.0), CPThemeStateBezeled | CPComboBoxStateButtonBordered],
[@"popup-button-size", CGSizeMake(17.0, 23.0), CPThemeStateBezeled],
// Because combo box uses a three-part bezel, the height is fixed
[@"min-size", CGSizeMake(0, 29.0)],
[@"max-size", CGSizeMake(-1, 29.0)]
];
[self registerThemeValues:overrides forView:combo inherit:themedTextFieldValues];
return combo;
}
+ (CPRadioButton)themedRadioButton
{
var button = [CPRadio radioWithTitle:@"Hello Friend!"],
+849
View File
@@ -0,0 +1,849 @@
/*
* _CPPopUpList.j
* AppKit
*
* Created by Aparajita Fishman.
* Copyright (c) 2012, The Cappuccino Foundation
*
* 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 "CPTableView.j"
@import "_CPPopUpListDataSource.j"
/*!
Notification sent when the list is about to pop up. \c object is the _CPPopUpList.
*/
_CPPopUpListWillPopUpNotification = @"_CPPopUpListWillPopUpNotification";
/*!
Notification sent when the list is about to be dismissed. \c object is the _CPPopUpList.
*/
_CPPopUpListWillDismissNotification = @"_CPPopUpListWillDismissNotification";
/*!
Notification sent when the list is dismissed. \c object is the _CPPopUpList.
*/
_CPPopUpListDidDismissNotification = @"_CPPopUpListDidDismissNotification";
/*!
Notification sent by when an item is selected. \c object is the _CPPopUpList.
When this is received the list has already been dismissed and the dismiss notification has been sent.
*/
_CPPopUpListItemWasClickedNotification = @"_CPPopUpListItemWasClickedNotification";
/*!
@ignore
The minimum number of items that must be visible below the related field.
If less than this number would be completely visible, and there is room for this many complete items
above the field, the list is displayed above.
*/
var ListMinimumItems = 3;
/*! @ignore */
var ListColumnIdentifier = @"1";
/*!
This class is a controller for a panel that can pop up and display a scrollable list of items in a CPTableView.
It is used by CPComboBox to display the list of choices.
This class requires a data source which must conform to the interface of _CPPopUpListDataSource.
Objects of this class send the following notifications:
_CPPopUpListWillPopUpNotification
_CPPopUpListWillDismissNotification
_CPPopUpListDidDismissNotification
_CPPopUpListItemWasClickedNotification
*/
@implementation _CPPopUpList : CPObject
{
_CPPopUpListDataSource _dataSource;
BOOL _itemWasClicked;
BOOL _listWasClicked;
int _listWidth;
_CPPopUpPanel _panel;
CPScrollView _scrollView;
_CPPopUpTableView _tableView;
CPTableColumn _tableColumn;
}
#pragma mark Creating and Displaying a List
/*!
Creates a pop up list of choices that will display in a scrollable CPTableView.
@param aDataSource A subclass of _CPPopUpListDataSource
*/
- (id)initWithDataSource:(_CPPopUpListDataSource)aDataSource
{
self = [super init];
if (self)
{
[self setDataSource:aDataSource];
_itemWasClicked = NO;
_listWasClicked = NO;
_listWidth = 0;
_tableView = [self makeTableView];
// Start with a default size, we will resize it later
frame = CGRectMake(0, 0, 200, 200);
_tableColumn = [[CPTableColumn alloc] initWithIdentifier:ListColumnIdentifier];
[_tableColumn setWidth:CGRectGetWidth(frame) - [CPScroller scrollerWidth]];
[_tableColumn setResizingMask:CPTableColumnAutoresizingMask];
[_tableView addTableColumn:_tableColumn];
_scrollView = [self makeScrollViewWithFrame:CGRectMake(0, 0, CGRectGetWidth(frame), CGRectGetHeight(frame))];
[_scrollView setDocumentView:_tableView];
// This has to be done after setDocumentView so that the table knows which scroll view to update
[_tableView setHeaderView:nil];
_panel = [self makeListPanelWithFrame:frame];
[[_panel contentView] addSubview:_scrollView];
[_panel setInitialFirstResponder:_tableView];
if ([_dataSource numberOfItemsInList:self] > 0)
[_tableView selectRowIndexes:[CPIndexSet indexSetWithIndex:0] byExtendingSelection:NO];
else
[_tableView setEnabled:NO];
[_scrollView scrollToBeginningOfDocument:nil];
}
return self;
}
/*! @ignore */
- (CPPanel)makeListPanelWithFrame:(CGRect)aFrame
{
var panel = [[_CPPopUpPanel alloc] initWithContentRect:aFrame styleMask:CPBorderlessWindowMask];
[panel setTitle:@""];
[panel setFloatingPanel:YES];
[panel setBecomesKeyOnlyIfNeeded:YES];
[panel setHasShadow:YES];
[panel setShadowStyle:CPMenuWindowShadowStyle];
[panel setDelegate:self];
return panel;
}
/*! @ignore */
- (_CPPopUpTableView)makeTableView
{
[self removeTableViewObservers];
var table = [[_CPPopUpTableView alloc] initWithFrame:CGRectMakeZero()];
[table setDelegate:self];
[table setDataSource:self];
[table setColumnAutoresizingStyle:CPTableViewLastColumnOnlyAutoresizingStyle];
[table setUsesAlternatingRowBackgroundColors:NO];
[table setAllowsMultipleSelection:NO];
[table setIntercellSpacing:CGSizeMake(3, 2)];
[table setTarget:self];
[table setDoubleAction:@selector(tableViewClickAction:)];
[table setAction:@selector(tableViewClickAction:)];
[table setRowHeight:[self rowHeightForTableView:table]];
return table;
}
/*! @ignore */
- (void)removeTableViewObservers
{
if (_tableView)
{
var defaultCenter = [CPNotificationCenter defaultCenter];
[defaultCenter removeObserver:self name:CPTableViewSelectionIsChangingNotification object:_tableView];
[defaultCenter removeObserver:self name:CPTableViewSelectionDidChangeNotification object:_tableView];
}
}
/*! @ignore */
- (CPScrollView)makeScrollViewWithFrame:(CGRect)aFrame
{
var scroll = [[CPScrollView alloc] initWithFrame:aFrame];
[scroll setBorderType:CPLineBorder];
[scroll setAutohidesScrollers:NO];
[scroll setHasVerticalScroller:YES];
[scroll setHasHorizontalScroller:NO];
[scroll setLineScroll:[_tableView rowHeight]];
[scroll setVerticalPageScroll:0.0];
return scroll;
}
/*!
Pop up the list if it is not already visible.
If it is not visible, a _CPPopUpListWillPopUpNotification will be sent.
@param aRect A rect (in \c aView coordinates) to display relative to
@param aView The view whose coordinate system \c aRect is in
@param offset How far to offset the list from \c aRect
*/
- (void)popUpRelativeToRect:(CGRect)aRect view:(CPView)aView offset:(int)offset
{
if ([_panel isVisible])
return;
var rowRect = [_tableView rectOfRow:[self numberOfRowsInTableView:_tableView] - 1],
frame = CGRectMake(0, 0, MAX(_listWidth, CGRectGetWidth(aRect)), CGRectGetMaxY(rowRect));
// Place the frame relative to aRect and constrain it to the screen bounds
frame = [self constrain:frame relativeToRect:aRect view:aView offset:offset];
[_panel setFrame:frame];
[_scrollView setFrameSize:CGSizeMakeCopy(frame.size)];
[_tableView setEnabled:[_dataSource numberOfItemsInList:self] > 0];
[self scrollItemAtIndexToTop:[_tableView selectedRow]];
[self listWillPopUp];
[_panel orderFront:nil];
}
#pragma mark Setting Display Attributes
/*!
Returns the desired width of the list.
*/
- (int)listWidth
{
return _listWidth;
}
/*!
Sets the desired width of the list for the next call to \ref showListForfield:relativeTo:.
Note that the actual display width may be larger if the given width is less than the width of the associated
field.
*/
- (void)setListWidth:(int)width
{
_listWidth = width;
}
- (void)setFont:(CPFont)aFont
{
var oldDataView = [_tableColumn dataView],
newDataView = [CPTextField new];
[newDataView setFont:aFont];
[newDataView setAlignment:[oldDataView alignment]];
[_tableColumn setDataView:newDataView];
// Force the data view cache to flush
[_tableView reloadData];
}
- (void)setAlignment:(CPTextAlignment)alignment
{
var oldDataView = [_tableColumn dataView],
newDataView = [CPTextField new];
[newDataView setAlignment:alignment];
[newDataView setFont:[oldDataView font]];
[_tableColumn setDataView:newDataView];
// Force the data view cache to flush
[_tableView reloadData];
}
/*!
Returns whether the list is currently visible.
*/
- (BOOL)isVisible
{
return [_panel isVisible];
}
/*!
Returns the desired row height for the table view.
Subclasses should override this if they want something other than the default.
*/
- (int)rowHeightForTableView:(CPTableView)aTableView
{
return [aTableView rowHeight];
}
/*!
Returns the table view used by the list.
*/
- (CPTableView)tableView
{
return _tableView;
}
/*!
Returns the single table column used by the list.
*/
- (CPTableColumn)tableColumn
{
return _tableColumn;
}
/*!
Returns the scroll view used by the list.
*/
- (CPScrollView)scrollView
{
return _scrollView;
}
/*!
Returns the panel in which the list appears.
*/
- (CPPanel)panel
{
return _panel;
}
#pragma mark Setting a Data Source
- (void)setDataSource:(_CPPopUpListDataSource)aDataSource
{
if (_dataSource === aDataSource)
return;
if (![_CPPopUpListDataSource protocolIsImplementedByObject:aDataSource])
{
CPLog.warn("Illegal %s data source (%s). Must implement the methods in _CPPopUpListDataSource.", [self className], [aDataSource description]);
}
else
_dataSource = aDataSource;
}
- (_CPPopUpListDataSource)dataSource
{
return _dataSource;
}
#pragma mark Manipulating the Selection
/*!
Select the next item in the list if there one. If there is currently no selected item,
the first item is selected. Returns YES if the selection changed.
*/
- (BOOL)selectNextItem
{
if (![_tableView isEnabled])
return NO;
var row = [_tableView selectedRow];
if (row < ([_dataSource numberOfItemsInList:self] - 1))
return [self selectRow:++row];
else
return NO;
}
/*!
Select the previous item in the list. If there is currently no selected item,
nothing happens. Returns YES if the selection changed.
*/
- (BOOL)selectPreviousItem
{
if (![_tableView isEnabled])
return NO;
var row = [_tableView selectedRow];
if (row > 0)
return [self selectRow:--row];
else
return NO;
}
/*!
Returns the selected object value. If no value is selected,
returns nil.
*/
- (id)selectedObjectValue
{
var row = [_tableView selectedRow];
return (row >= 0) ? [_dataSource list:self objectValueForItemAtIndex:row] : nil;
}
/*!
Returns the selected value as a single-line string. If no value is selected,
returns nil.
*/
- (CPString)selectedStringValue
{
var value = [self selectedObjectValue];
return value !== nil ? [_dataSource list:self stringValueForObjectValue:value] : nil;
}
/*!
Returns the last selected row in the list. If no row has been selected, returns -1.
*/
- (int)selectedRow
{
return [_tableView selectedRow];
}
/*!
Selects a row and scrolls it to be visible. Returns YES if the selection actually changed.
*/
- (BOOL)selectRow:(int)row
{
if (row === [_tableView selectedRow])
return NO;
var validRow = (row >= 0 && row < [self numberOfRowsInTableView:_tableView]),
indexes = validRow ? [CPIndexSet indexSetWithIndex:row] : [CPIndexSet indexSet];
[_tableView selectRowIndexes:indexes byExtendingSelection:NO];
if (validRow)
{
[_tableView scrollRowToVisible:row];
return YES;
}
else
return NO;
}
#pragma mark Manipulating the Displayed List
/*!
Scroll the list down one page.
*/
- (void)scrollPageDown
{
[_scrollView scrollPageDown:nil];
}
/*!
Scroll the list up one page.
*/
- (void)scrollPageUp
{
[_scrollView scrollPageUp:nil];
}
/*!
Scroll to the top of the list.
*/
- (void)scrollToTop
{
[_scrollView scrollToBeginningOfDocument:nil];
}
/*!
Scroll to the bottom of the list.
*/
- (void)scrollToBottom
{
[_scrollView scrollToEndOfDocument:nil];
}
- (void)scrollItemAtIndexToTop:(int)row
{
var rect = [_tableView rectOfRow:row];
[[_tableView superview] scrollToPoint:rect.origin];
}
/*!
Close the list if it is currently visible. If it is visible,
a CPComboBoxWillDismissNotification will be sent. If the
list is being closed after an item was clicked, the close
is delayed slightly so the user can briefly see the clicked row
get highlighted.
*/
- (void)close
{
if (![_panel isVisible])
return;
if ([self listWasClicked])
{
[self setListWasClicked:NO];
// Wait until we get through the run loop and delay a little
// so the user can briefly see the clicked row get highlighted.
if ([self itemWasClicked])
{
[self setItemWasClicked:NO];
[CPTimer scheduledTimerWithTimeInterval:0.1 target:self selector:@selector(closeListAfterItemClick) userInfo:nil repeats:NO];
return;
}
}
[[CPNotificationCenter defaultCenter] postNotificationName:_CPPopUpListWillDismissNotification object:self];
[_panel close];
[[CPNotificationCenter defaultCenter] postNotificationName:_CPPopUpListDidDismissNotification object:self];
}
/*!
Close the list after an item was clicked.
*/
- (void)closeListAfterItemClick
{
[self close];
[[CPNotificationCenter defaultCenter] postNotificationName:_CPPopUpListItemWasClickedNotification object:self];
}
#pragma mark Handling Events
/*!
Handles standard key equivalents for moving the selection
and selecting an item. This method should be called by
the -performKeyEquivalent method of the field that is
controlling the list.
*/
- (BOOL)performKeyEquivalent:(CPEvent)anEvent
{
var key = [anEvent charactersIgnoringModifiers];
switch (key)
{
case CPDownArrowFunctionKey:
if ([self isVisible])
{
[self selectNextItem];
return YES;
}
break;
case CPUpArrowFunctionKey:
if ([self isVisible])
{
[self selectPreviousItem];
return YES;
}
break;
case CPEscapeFunctionKey:
if ([self isVisible])
{
[self close];
return YES;
}
break;
case CPPageUpFunctionKey:
if ([self isVisible])
{
[self scrollPageUp];
return YES;
}
break;
case CPPageDownFunctionKey:
if ([self isVisible])
{
[self scrollPageDown];
return YES;
}
break;
case CPHomeFunctionKey:
if ([self isVisible])
{
[self scrollToTop];
return YES;
}
break;
case CPEndFunctionKey:
if ([self isVisible])
{
[self scrollToBottom];
return YES;
}
break;
}
return NO;
}
/*!
Returns whether an item in the list was clicked since it was opened.
If there are no items, \ref itemWasClicked will always return NO.
*/
- (BOOL)itemWasClicked
{
return _itemWasClicked && ([_dataSource numberOfItemsInList:self] > 0);
}
/*!
Sets whether an item in the list was clicked since it was opened.
If there are no items, \ref itemWasClicked will always return NO.
Subclasses will usually want to set this in the mouseDown:
of the control.
*/
- (void)setItemWasClicked:(BOOL)flag
{
_itemWasClicked = ([_dataSource numberOfItemsInList:self] > 0) && flag;
}
/*!
Returns whether any view in the list was clicked since it was opened.
If there are no items, \ref listWasClicked will always return NO.
*/
- (BOOL)listWasClicked
{
return _listWasClicked && ([_dataSource numberOfItemsInList:self] > 0);
}
/*!
Sets whether any view in the list was clicked since it was opened.
If there are no items, \ref listWasClicked will always return NO.
Subclasses will usually want to use a subclass of CPPanel and override
sendEvent: to set this flag when the event type is CPLeftMouseDown
or CPRightMouseDown. This is distinct from \ref itemWasClicked because,
for example, a scroller in the list may be clicked without clicking an
item in the list.
*/
- (void)setListWasClicked:(BOOL)flag
{
_listWasClicked = ([_dataSource numberOfItemsInList:self] > 0) && flag;
}
/*!
Returns whether a controlling view should resign. This should be called
from the controlling view's resignFirstResponder method.
*/
- (BOOL)controllingViewShouldResign
{
if ([self listWasClicked])
{
/*
If an item was not clicked (probably the scrollbar), clear the click flag so that future
clicks outside the list will allow it to close.
*/
if ([self listWasClicked] && ![self itemWasClicked])
[self setListWasClicked:NO];
return NO;
}
else
return YES;
}
#pragma mark Internal Helpers
/*! @ignore */
- (void)listWillPopUp
{
[[CPNotificationCenter defaultCenter] postNotificationName:_CPPopUpListWillPopUpNotification object:self];
}
/*!
Return a frame in platform window base coordinates such that the list, when displayed, will show at least ListMinimumItems
items completely on screen. Normally the list should be displayed below \c aRect, but if there is not room
for at least ListMinimumItems items, an attempt should be made to display that many
items above \c aRect. If the minimum cannot be displayed on top, whichever direction can display more items
is chosen.
@ignore
*/
- (CGRect)constrain:(CGRect)aFrame relativeToRect:(CGRect)aRect view:(CPView)aView offset:(int)offset
{
// Convert from the view's coordinate system to the coordinate system of the primary platform window
var baseOrigin = [aView convertPointToBase:aRect.origin],
windowOrigin = [[aView window] convertBaseToPlatformWindow:baseOrigin],
rowHeight = [self rowHeightForTableView:_tableView] + [_tableView intercellSpacing].height,
// Be sure to clip the number of displayed rows to what the field wants
numberOfRows = MIN([self numberOfRowsInTableView:_tableView], [_dataSource numberOfVisibleItemsInList:self]),
// Add 2 to height for border
frame = CGRectMake(windowOrigin.x, windowOrigin.y + CGRectGetHeight(aRect) + offset, MAX(_listWidth, CGRectGetWidth(aFrame)), (rowHeight * numberOfRows) + 2),
// Get the bottom coordinate of the frame and the platform window
bottomFrame = CGRectMakeCopy(frame),
bottom = CGRectGetMaxY(bottomFrame),
viewRect = [[CPPlatformWindow primaryPlatformWindow] visibleFrame],
visibleBottom = CGRectGetMaxY(viewRect),
bottomVisibleRows = numberOfRows;
// Make sure it will fit in the screen. If not, reduce the number of items till we reach the minimum.
while (bottom > visibleBottom && bottomVisibleRows >= ListMinimumItems)
{
bottom -= rowHeight;
bottomFrame.size.height -= rowHeight;
--bottomVisibleRows;
}
if (bottom >= visibleBottom || bottomVisibleRows < ListMinimumItems)
{
// The minimum number of items will not fit, try above
var topFrame = CGRectMakeCopy(frame);
topFrame.origin.y = windowOrigin.y - offset - CGRectGetHeight(topFrame);
var visibleTop = CGRectGetMinY(viewRect),
topVisibleRows = numberOfRows;
while (topFrame.origin.y <= visibleTop && topVisibleRows >= ListMinimumItems)
{
topFrame.origin.y += rowHeight;
topFrame.size.height -= rowHeight;
--topVisibleRows;
}
// If there is room on the top or it can display more than at the bottom, show it there
if ((topFrame.origin.y > visibleTop && topVisibleRows >= ListMinimumItems) || topVisibleRows > bottomVisibleRows)
frame = topFrame;
else
frame = bottomFrame;
}
else
frame = bottomFrame;
return frame;
}
- (void)tableViewClickAction:(id)sender
{
[self close];
}
@end
var _CPPopUpListDataSourceKey = @"_CPPopUpListDataSourceKey",
_CPPopUpListListWidthKey = @"_CPPopUpListListWidthKey",
_CPPopUpListListPanelKey = @"_CPPopUpListListPanelKey",
_CPPopUpListScrollViewKey = @"_CPPopUpListScrollViewKey",
_CPPopUpListTableViewKey = @"_CPPopUpListTableViewKey";
@implementation _CPPopUpList (CPCoding)
- (id)initWithCoder:(CPCoder)aCoder
{
self = [super initWithCoder:aCoder];
if (self)
{
_listWasClicked = NO;
_itemWasClicked = NO;
_dataSource = [aCoder decodeObjectForKey:_CPPopUpListDataSourceKey];
_listWidth = [aCoder decodeIntForKey:_CPPopUpListListWidthKey];
_panel = [aCoder decodeObjectForKey:_CPPopUpListListPanelKey];
_scrollView = [aCoder decodeObjectForKey:_CPPopUpListScrollViewKey];
_tableView = [aCoder decodeObjectForKey:_CPPopUpListTableViewKey];
_tableColumn = [_tableView tableColumnWithIdentifier:ListColumnIdentifier];
[_scrollView setDocumentView:_tableView];
}
return self;
}
- (void)encodeWithCoder:(CPCoder)aCoder
{
[super encodeWithCoder:aCoder];
[aCoder encodeObject:_dataSource forKey:_CPPopUpListDataSourceKey];
[aCoder encodeObject:_listWidth forKey:_CPPopUpListListWidthKey];
[aCoder encodeObject:_panel forKey:_CPPopUpListListPanelKey];
[aCoder encodeObject:_scrollView forKey:_CPPopUpListScrollViewKey];
[aCoder encodeObject:_tableView forKey:_CPPopUpListTableViewKey];
}
@end
@implementation _CPPopUpList (CPTableViewDataSource)
- (int)numberOfRowsInTableView:(id)aTableView
{
return MAX([_dataSource numberOfItemsInList:self], 1);
}
- (id)tableView:(id)aTableView objectValueForTableColumn:(CPTableColumn)aColumn row:(int)aRow
{
return [_dataSource list:self displayValueForObjectValue:[_dataSource list:self objectValueForItemAtIndex:aRow]];
}
@end
@implementation _CPPopUpTableView : CPTableView
{
BOOL _acceptFirstResponder;
}
- (id)initWithFrame:(CGRect)aFrame
{
if (self = [super initWithFrame:aFrame])
{
// We want the autocomplete to remain first responder until we are clicked.
_acceptFirstResponder = NO;
}
return self;
}
- (void)trackMouse:(CPEvent)anEvent
{
if (![self isEnabled])
return;
[[self delegate] setItemWasClicked:YES];
// CPTableView will not track the click if it is not first responder
_acceptFirstResponder = YES;
[[self window] makeFirstResponder:self];
[super trackMouse:anEvent];
}
- (void)stopTracking:(CGPoint)lastPoint at:(CGPoint)aPoint mouseIsUp:(BOOL)mouseIsUp
{
_acceptFirstResponder = NO;
[super stopTracking:lastPoint at:aPoint mouseIsUp:mouseIsUp];
}
- (BOOL)acceptsFirstResponder
{
return _acceptFirstResponder;
}
/*!
Return the column used for the list.
*/
- (CPTableColumn)listColumn
{
return _tableColumn;
}
@end
@implementation _CPPopUpPanel : CPPanel
- (void)sendEvent:(CPEvent)anEvent
{
var type = [anEvent type];
if (type === CPLeftMouseDown || type === CPRightMouseDown)
[[self delegate] setListWasClicked:YES];
return [super sendEvent:anEvent];
}
@end
+98
View File
@@ -0,0 +1,98 @@
/*
* _CPPopUpListDataSource.j
* AppKit
*
* Created by Aparajita Fishman.
* Copyright (c) 2012, The Cappuccino Foundation
*
* 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
*/
/*!
This abstract base class defines the methods that delegates of _CPPopUpList must implement.
You may either subclass this class to use the default implementation of
list:objectValueForItemAtIndex: and list:displayValueForObjectValue: or use your
own class and define these methods yourself.
*/
@implementation _CPPopUpListDataSource : CPObject
/*!
Returns whether the given object conforms to the minimum protocol defined by this class.
*/
+ (BOOL)protocolIsImplementedByObject:(id)anObject
{
return (anObject &&
[anObject respondsToSelector:@selector(numberOfItemsInList:)] &&
[anObject respondsToSelector:@selector(numberOfVisibleItemsInList:)] &&
[anObject respondsToSelector:@selector(list:objectValueForItemAtIndex:)] &&
[anObject respondsToSelector:@selector(list:displayValueForObjectValue:)] &&
[anObject respondsToSelector:@selector(list:stringValueForObjectValue:)]);
}
/*!
Returns the number of items managed by the list.
*/
- (int)numberOfItemsInList:(_CPPopUpList)aList
{
_CPRaiseInvalidAbstractInvocation(self, _cmd);
}
/*!
Returns the number of items to display at one time.
*/
- (int)numberOfVisibleItemsInList:(_CPPopUpList)aList
{
_CPRaiseInvalidAbstractInvocation(self, _cmd);
}
/*!
Returns the data for a given row index.
*/
- (id)list:(_CPPopUpList)aList objectValueForItemAtIndex:(int)index
{
_CPRaiseInvalidAbstractInvocation(self, _cmd);
}
/*!
Returns a value to display for a single row in the list. Subclasses should override
this if the table data needs to be converted or formatted in some way to be displayed.
If your data source use a data representation other than CPStrings, you must override
this method and return the appropriate data when there are no search results.
If the _CPPopUpList's table uses a custom data view, this method should return a value suitable
for sending to the setObjectValue: method of the data view.
@param aValue Data for the given row
@return A value to be displayed in the list
*/
- (id)list:(_CPPopUpList)aList displayValueForObjectValue:(id)aValue
{
return aValue || @"";
}
/*!
Returns a single-line string representation for an object value. Subclasses should override
this if the object data is not convertible to a simple single-line string.
@param aValue Table data to be converted to a string
@return A value to be displayed in the autocomplete field
*/
- (CPString)list:(_CPPopUpList)aList stringValueForObjectValue:(id)aValue
{
return String(aValue);
}
@end
+228
View File
@@ -0,0 +1,228 @@
/*
* AppController.j
* CPComboBoxTest
*
* Created by Aparajita Fishman.
* Copyright (c) 2011, Intalio, 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 <AppKit/CPComboBox.j>
@implementation Companies : CPObject
{
CPMutableArray items @accessors;
}
- (id)init
{
self = [super init];
if (self)
{
items = [CPMutableArray array];
var employees = "Tom,Dick,Harry,Ted,Sam,Fred,Ralph,Ed,Tim,John,Bill,Irving,Stan,Rodney".split(",");
employees = [CPArray arrayWithObjects:employees count:employees.length];
[items addObject:[CPDictionary dictionaryWithObjectsAndKeys:@"Spacely Sprockets", @"name", employees, @"employees"]];
employees = "Jane,Sally,Joan,Sara,Melissa,Beverly,Gillian,Sandra,Samantha,Mary,Kate".split(",");
employees = [CPArray arrayWithObjects:employees count:employees.length];
[items addObject:[CPDictionary dictionaryWithObjectsAndKeys:@"Cogswell Cogs", @"name", employees, @"employees"]];
}
return self;
}
@end
@implementation AppController : CPObject
{
@outlet CPWindow theWindow;
CPWindow testWindow;
CPString employee @accessors;
Companies companies @accessors;
CPArrayController companiesController;
CPArrayController employeesController;
CPComboBox combo;
@outlet CPComboBox cibCombo;
@outlet CPTextField comboTarget;
CPString fontName;
int nextCheckboxY;
}
- (id)init
{
if (self = [super init])
{
fontName = [CPFont systemFontFace];
companies = [Companies new];
}
return self;
}
- (void)awakeFromCib
{
}
- (void)applicationDidFinishLaunching:(CPNotification)aNotification
{
testWindow = [[CPWindow alloc] initWithContentRect:CGRectMake(30, 50, 500, 400) styleMask:CPTitledWindowMask | CPResizableWindowMask];
var contentView = [testWindow contentView],
companiesScrollView = [[CPScrollView alloc] initWithFrame:CGRectMake(30, 30, 200, 100)],
companiesTable = [[CPTableView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)],
employeesScrollView = [[CPScrollView alloc] initWithFrame:CGRectMake(250, 30, 200, 200)],
employeesTable = [[CPTableView alloc] initWithFrame:CGRectMake(0, 0, 200, 200)];
[testWindow setTitle:@"CPComboBox (from code)"];
var column = [[CPTableColumn alloc] initWithIdentifier:@"name"];
[column setResizingMask:CPTableColumnAutoresizingMask];
[companiesTable addTableColumn:column];
[companiesTable setAllowsMultipleSelection:YES];
[companiesTable setColumnAutoresizingStyle:CPTableViewLastColumnOnlyAutoresizingStyle];
[companiesScrollView setHasHorizontalScroller:NO];
[companiesScrollView setHasVerticalScroller:YES];
[companiesScrollView setDocumentView:companiesTable];
[companiesScrollView setBorderType:CPBezelBorder];
[companiesTable setHeaderView:nil];
[companiesTable setAllowsEmptySelection:NO];
[contentView addSubview:companiesScrollView];
column = [[CPTableColumn alloc] initWithIdentifier:@"name"];
[column setResizingMask:CPTableColumnAutoresizingMask];
[employeesTable addTableColumn:column];
[employeesTable setAllowsMultipleSelection:YES];
[employeesTable setColumnAutoresizingStyle:CPTableViewLastColumnOnlyAutoresizingStyle];
[employeesScrollView setHasHorizontalScroller:NO];
[employeesScrollView setHasVerticalScroller:YES];
[employeesScrollView setDocumentView:employeesTable];
[employeesScrollView setBorderType:CPBezelBorder];
[employeesTable setHeaderView:nil];
[employeesTable setAllowsEmptySelection:YES];
[contentView addSubview:employeesScrollView];
combo = [[CPComboBox alloc] initWithFrame:CGRectMake(250, 240, 200, 29)];
[combo setCompletes:YES];
[contentView addSubview:combo];
var textfield = [CPTextField textFieldWithStringValue:@"" placeholder:@"" width:200];
[textfield setFrameOrigin:CGPointMake(250, 290)];
[contentView addSubview:textfield];
var center = [CPNotificationCenter defaultCenter];
[center addObserver:self selector:@selector(comboNote:) name:CPComboBoxSelectionDidChangeNotification object:combo];
[center addObserver:self selector:@selector(comboNote:) name:CPComboBoxSelectionIsChangingNotification object:combo];
[center addObserver:self selector:@selector(comboNote:) name:CPComboBoxWillDismissNotification object:combo];
[center addObserver:self selector:@selector(comboNote:) name:CPComboBoxWillPopUpNotification object:combo];
[center addObserver:self selector:@selector(comboNote:) name:CPControlTextDidEndEditingNotification object:combo];
nextCheckboxY = 166;
[self makeCheckBoxWithTitle:@"Enabled" defaultState:CPOnState];
[self makeCheckBoxWithTitle:@"Button bordered" defaultState:CPOnState];
[self makeCheckBoxWithTitle:@"Bold" defaultState:CPOffState];
[self makeCheckBoxWithTitle:@"Completes" defaultState:CPOnState];
[self makeCheckBoxWithTitle:@"Force selection" defaultState:CPOffState];
[self makeCheckBoxWithTitle:@"Vertical scrollbar" defaultState:CPOnState];
[self makeCheckBoxWithTitle:@"Big item height" defaultState:CPOffState];
[self makeCheckBoxWithTitle:@"More visible items" defaultState:CPOffState];
companiesController = [CPArrayController new];
[companiesController bind:@"contentArray" toObject:companies withKeyPath:@"items" options:nil];
employeesController = [CPArrayController new];
[employeesController bind:@"contentArray" toObject:companiesController withKeyPath:@"selection.employees" options:nil];
var employeeController = [CPObjectController new];
[employeeController bind:@"content" toObject:employeesController withKeyPath:@"selection.self" options:nil];
[[companiesTable tableColumnWithIdentifier:@"name"] bind:@"value" toObject:companiesController withKeyPath:@"arrangedObjects.name" options:nil];
[[employeesTable tableColumnWithIdentifier:@"name"] bind:@"value" toObject:employeesController withKeyPath:@"arrangedObjects" options:nil];
[combo bind:@"contentValues" toObject:employeesController withKeyPath:@"arrangedObjects" options:nil];
[combo bind:@"value" toObject:employeeController withKeyPath:@"content" options:nil];
[companiesController addObserver:self forKeyPath:@"selection" options:0 context:@"companies.selection"];
[companiesController addObserver:self forKeyPath:@"selectionIndexes" options:0 context:@"companies.selectionIndexes"];
[companiesController addObserver:self forKeyPath:@"arrangedObjects" options:0 context:@"companies.arrangedObjects"];
[employeesController addObserver:self forKeyPath:@"selectionIndexes" options:0 context:@"employees.selectionIndexes"];
[employeesController addObserver:self forKeyPath:@"selection" options:0 context:@"employees.selection"];
[employeesController addObserver:self forKeyPath:@"arrangedObjects" options:0 context:@"employees.arrangedObjects"];
[combo addObserver:self forKeyPath:@"value" options:0 context:@"combo.value"];
[testWindow setInitialFirstResponder:combo];
[testWindow makeKeyAndOrderFront:self];
}
- (void)makeCheckBoxWithTitle:(CPString)aTitle defaultState:(BOOL)aState
{
var checkbox = [CPCheckBox checkBoxWithTitle:aTitle];
[checkbox setFrameOrigin:CGPointMake(55, nextCheckboxY)];
[checkbox setState:aState];
[checkbox setTarget:self];
[checkbox setAction:@selector(setComboState:)];
[[testWindow contentView] addSubview:checkbox];
nextCheckboxY += 25;
}
- (void)observeValueForKeyPath:(CPString)keyPath ofObject:(id)object change:(CPDictionary)change context:(id)context
{
console.log("\nkeyPath: %s\ncontext: %s\nnew: %s\nold: %s", keyPath, context, [[change valueForKey:CPKeyValueChangeNewKey] description], [[change valueForKey:CPKeyValueChangeOldKey] description]);
}
- (void)setComboState:(id)sender
{
var title = [sender title],
state = [sender state] === CPOnState;
if (title === @"Enabled")
[combo setEnabled:state];
else if (title === @"Button bordered")
[combo setButtonBordered:state];
else if (title === @"Bold")
{
var font = [sender state] === CPOnState ? [CPFont boldFontWithName:fontName size:12] : [CPFont fontWithName:fontName size:12];
[combo setFont:font];
}
else if (title === @"Completes")
[combo setCompletes:state];
else if (title === @"Force selection")
[combo setForceSelection:state];
else if (title === @"Vertical scroller")
[combo setHasVerticalScroller:state];
else if (title === @"Big item height")
[combo setItemHeight:state ? 47 : 23];
else if (title === @"More visible items")
[combo setNumberOfVisibleItems:state ? 10 : 5];
}
- (void)comboNote:(CPNotification)aNote
{
console.log([aNote name]);
var object = [aNote object];
if ([aNote name] === CPComboBoxWillDismissNotification)
console.log("Selected: %d - %s", [object indexOfSelectedItem], [object objectValueOfSelectedItem]);
}
@end
+10
View File
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Main cib file base name</key>
<string>MainMenu.cib</string>
<key>CPBundleName</key>
<string>CPComboBoxTest</string>
</dict>
</plist>
+94
View File
@@ -0,0 +1,94 @@
/*
* Jakefile
* test
*
* Created by aparajita on August 19, 2011.
* Copyright 2011, Victory-Heart Productions All rights reserved.
*/
var ENV = require("system").env,
FILE = require("file"),
JAKE = require("jake"),
task = JAKE.task,
FileList = JAKE.FileList,
app = require("cappuccino/jake").app,
configuration = ENV["CONFIG"] || ENV["CONFIGURATION"] || ENV["c"] || "Debug",
OS = require("os");
app ("test", function(task)
{
task.setBuildIntermediatesPath(FILE.join("Build", "test.build", configuration));
task.setBuildPath(FILE.join("Build", configuration));
task.setProductName("test");
task.setIdentifier("com.aparajita.test");
task.setVersion("1.0");
task.setAuthor("Victory-Heart Productions");
task.setEmail("feedback @nospam@ yourcompany.com");
task.setSummary("test");
task.setSources((new FileList("**/*.j")).exclude(FILE.join("Build", "**")));
task.setResources(new FileList("Resources/**"));
task.setIndexFilePath("index.html");
task.setInfoPlistPath("Info.plist");
task.setNib2CibFlags("-R Resources/");
if (configuration === "Debug")
task.setCompilerFlags("-DDEBUG -g");
else
task.setCompilerFlags("-O");
});
task ("default", ["test"], function()
{
printResults(configuration);
});
task ("build", ["default"]);
task ("debug", function()
{
ENV["CONFIGURATION"] = "Debug";
JAKE.subjake(["."], "build", ENV);
});
task ("release", function()
{
ENV["CONFIGURATION"] = "Release";
JAKE.subjake(["."], "build", ENV);
});
task ("run", ["debug"], function()
{
OS.system(["open", FILE.join("Build", "Debug", "test", "index.html")]);
});
task ("run-release", ["release"], function()
{
OS.system(["open", FILE.join("Build", "Release", "test", "index.html")]);
});
task ("deploy", ["release"], function()
{
FILE.mkdirs(FILE.join("Build", "Deployment", "test"));
OS.system(["press", "-f", FILE.join("Build", "Release", "test"), FILE.join("Build", "Deployment", "test")]);
printResults("Deployment")
});
task ("desktop", ["release"], function()
{
FILE.mkdirs(FILE.join("Build", "Desktop", "test"));
require("cappuccino/nativehost").buildNativeHost(FILE.join("Build", "Release", "test"), FILE.join("Build", "Desktop", "test", "test.app"));
printResults("Desktop")
});
task ("run-desktop", ["desktop"], function()
{
OS.system([FILE.join("Build", "Desktop", "test", "test.app", "Contents", "MacOS", "NativeHost"), "-i"]);
});
function printResults(configuration)
{
print("----------------------------");
print(configuration+" app built at path: "+FILE.join("Build", configuration, "test"));
print("----------------------------");
}
File diff suppressed because one or more lines are too long
@@ -0,0 +1,828 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10">
<data>
<int key="IBDocument.SystemTarget">1050</int>
<string key="IBDocument.SystemVersion">11E53</string>
<string key="IBDocument.InterfaceBuilderVersion">2182</string>
<string key="IBDocument.AppKitVersion">1138.47</string>
<string key="IBDocument.HIToolboxVersion">569.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="NS.object.0">2182</string>
</object>
<object class="NSArray" key="IBDocument.IntegratedClassDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>NSView</string>
<string>NSComboBox</string>
<string>NSWindowTemplate</string>
<string>NSObjectController</string>
<string>NSTextField</string>
<string>NSTextFieldCell</string>
<string>NSButtonCell</string>
<string>NSComboBoxCell</string>
<string>NSButton</string>
<string>NSCustomObject</string>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
</object>
<object class="NSMutableDictionary" key="IBDocument.Metadata">
<string key="NS.key.0">PluginDependencyRecalculationVersion</string>
<integer value="1" key="NS.object.0"/>
</object>
<object class="NSMutableArray" key="IBDocument.RootObjects" id="1048">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSCustomObject" id="1021">
<string key="NSClassName">NSApplication</string>
</object>
<object class="NSCustomObject" id="1014">
<string key="NSClassName">FirstResponder</string>
</object>
<object class="NSCustomObject" id="1050">
<string key="NSClassName">NSApplication</string>
</object>
<object class="NSCustomObject" id="635946545">
<string key="NSClassName">AppController</string>
</object>
<object class="NSObjectController" id="412838899">
<string key="NSObjectClassName">NSComboBox</string>
<bool key="NSEditable">YES</bool>
<object class="_NSManagedProxy" key="_NSManagedProxy"/>
</object>
<object class="NSWindowTemplate" id="739395868">
<int key="NSWindowStyleMask">15</int>
<int key="NSWindowBacking">2</int>
<string key="NSWindowRect">{{583, 961}, {394, 166}}</string>
<int key="NSWTFlags">544735232</int>
<string key="NSWindowTitle">CPComboBox (from cib)</string>
<string key="NSWindowClass">NSWindow</string>
<nil key="NSViewClass"/>
<nil key="NSUserInterfaceItemIdentifier"/>
<object class="NSView" key="NSWindowView" id="177694051">
<reference key="NSNextResponder"/>
<int key="NSvFlags">256</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSComboBox" id="584113036">
<reference key="NSNextResponder" ref="177694051"/>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{20, 115}, {191, 26}}</string>
<reference key="NSSuperview" ref="177694051"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="288514536"/>
<bool key="NSEnabled">YES</bool>
<object class="NSComboBoxCell" key="NSCell" id="58512575">
<int key="NSCellFlags">343014976</int>
<int key="NSCellFlags2">272630784</int>
<string key="NSContents"/>
<object class="NSFont" key="NSSupport" id="64180879">
<string key="NSName">LucidaGrande</string>
<double key="NSSize">13</double>
<int key="NSfFlags">1044</int>
</object>
<reference key="NSControlView" ref="584113036"/>
<bool key="NSDrawsBackground">YES</bool>
<object class="NSColor" key="NSBackgroundColor" id="1070974640">
<int key="NSColorSpace">6</int>
<string key="NSCatalogName">System</string>
<string key="NSColorName">textBackgroundColor</string>
<object class="NSColor" key="NSColor" id="308779708">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MQA</bytes>
</object>
</object>
<object class="NSColor" key="NSTextColor" id="234844066">
<int key="NSColorSpace">6</int>
<string key="NSCatalogName">System</string>
<string key="NSColorName">controlTextColor</string>
<object class="NSColor" key="NSColor" id="804288982">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MAA</bytes>
</object>
</object>
<int key="NSVisibleItemCount">7</int>
<bool key="NSHasVerticalScroller">YES</bool>
<bool key="NSCompletes">YES</bool>
<object class="NSMutableArray" key="NSPopUpListData">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>Moe</string>
<string>Larry</string>
<string>Cheese</string>
<string>Curly</string>
<string>Shemp</string>
<string>Groucho</string>
<string>Harpo</string>
<string>Chico</string>
<string>Zeppo</string>
</object>
<reference key="NSDelegate" ref="584113036"/>
<object class="NSComboTableView" key="NSTableView" id="116006387">
<reference key="NSNextResponder"/>
<int key="NSvFlags">274</int>
<string key="NSFrameSize">{13, 189}</string>
<reference key="NSSuperview"/>
<reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSMutableArray" key="NSTableColumns">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSTableColumn">
<double key="NSWidth">10</double>
<double key="NSMinWidth">10</double>
<double key="NSMaxWidth">1000</double>
<object class="NSTableHeaderCell" key="NSHeaderCell">
<int key="NSCellFlags">75628032</int>
<int key="NSCellFlags2">0</int>
<string key="NSContents"/>
<object class="NSFont" key="NSSupport">
<string key="NSName">LucidaGrande</string>
<double key="NSSize">12</double>
<int key="NSfFlags">16</int>
</object>
<object class="NSColor" key="NSBackgroundColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MC4zMzMzMzI5ODU2AA</bytes>
</object>
<reference key="NSTextColor" ref="308779708"/>
</object>
<object class="NSTextFieldCell" key="NSDataCell">
<int key="NSCellFlags">338820672</int>
<int key="NSCellFlags2">268436480</int>
<reference key="NSSupport" ref="64180879"/>
<reference key="NSControlView" ref="116006387"/>
<bool key="NSDrawsBackground">YES</bool>
<object class="NSColor" key="NSBackgroundColor" id="729693961">
<int key="NSColorSpace">6</int>
<string key="NSCatalogName">System</string>
<string key="NSColorName">controlBackgroundColor</string>
<object class="NSColor" key="NSColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MC42NjY2NjY2NjY3AA</bytes>
</object>
</object>
<reference key="NSTextColor" ref="234844066"/>
</object>
<int key="NSResizingMask">3</int>
<bool key="NSIsResizeable">YES</bool>
<reference key="NSTableView" ref="116006387"/>
</object>
</object>
<double key="NSIntercellSpacingWidth">3</double>
<double key="NSIntercellSpacingHeight">2</double>
<reference key="NSBackgroundColor" ref="729693961"/>
<object class="NSColor" key="NSGridColor">
<int key="NSColorSpace">6</int>
<string key="NSCatalogName">System</string>
<string key="NSColorName">gridColor</string>
<object class="NSColor" key="NSColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MC41AA</bytes>
</object>
</object>
<double key="NSRowHeight">19</double>
<string key="NSAction">tableViewAction:</string>
<int key="NSTvFlags">-765427712</int>
<reference key="NSDelegate" ref="58512575"/>
<reference key="NSDataSource" ref="58512575"/>
<reference key="NSTarget" ref="58512575"/>
<int key="NSColumnAutoresizingStyle">1</int>
<int key="NSDraggingSourceMaskForLocal">15</int>
<int key="NSDraggingSourceMaskForNonLocal">0</int>
<bool key="NSAllowsTypeSelect">YES</bool>
<int key="NSTableViewDraggingDestinationStyle">0</int>
<int key="NSTableViewGroupRowStyle">1</int>
</object>
</object>
</object>
<object class="NSButton" id="288514536">
<reference key="NSNextResponder" ref="177694051"/>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{247, 118}, {72, 18}}</string>
<reference key="NSSuperview" ref="177694051"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="104434533"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="132463171">
<int key="NSCellFlags">-2080244224</int>
<int key="NSCellFlags2">0</int>
<string key="NSContents">Enabled</string>
<reference key="NSSupport" ref="64180879"/>
<reference key="NSControlView" ref="288514536"/>
<int key="NSButtonFlags">1211912703</int>
<int key="NSButtonFlags2">2</int>
<object class="NSCustomResource" key="NSNormalImage" id="887534559">
<string key="NSClassName">NSImage</string>
<string key="NSResourceName">NSSwitch</string>
</object>
<object class="NSButtonImageSource" key="NSAlternateImage" id="286406562">
<string key="NSImageName">NSSwitch</string>
</object>
<string key="NSAlternateContents"/>
<string key="NSKeyEquivalent"/>
<int key="NSPeriodicDelay">200</int>
<int key="NSPeriodicInterval">25</int>
</object>
</object>
<object class="NSButton" id="104434533">
<reference key="NSNextResponder" ref="177694051"/>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{247, 93}, {125, 18}}</string>
<reference key="NSSuperview" ref="177694051"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="846797034"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="299849276">
<int key="NSCellFlags">-2080244224</int>
<int key="NSCellFlags2">0</int>
<string key="NSContents">Button bordered</string>
<reference key="NSSupport" ref="64180879"/>
<reference key="NSControlView" ref="104434533"/>
<int key="NSButtonFlags">1211912703</int>
<int key="NSButtonFlags2">2</int>
<reference key="NSNormalImage" ref="887534559"/>
<reference key="NSAlternateImage" ref="286406562"/>
<string key="NSAlternateContents"/>
<string key="NSKeyEquivalent"/>
<int key="NSPeriodicDelay">200</int>
<int key="NSPeriodicInterval">25</int>
</object>
</object>
<object class="NSButton" id="121703403">
<reference key="NSNextResponder" ref="177694051"/>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{247, 68}, {89, 18}}</string>
<reference key="NSSuperview" ref="177694051"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="583065641"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="794409030">
<int key="NSCellFlags">-2080244224</int>
<int key="NSCellFlags2">0</int>
<string key="NSContents">Completes</string>
<reference key="NSSupport" ref="64180879"/>
<reference key="NSControlView" ref="121703403"/>
<int key="NSButtonFlags">1211912703</int>
<int key="NSButtonFlags2">2</int>
<reference key="NSNormalImage" ref="887534559"/>
<reference key="NSAlternateImage" ref="286406562"/>
<string key="NSAlternateContents"/>
<string key="NSKeyEquivalent"/>
<int key="NSPeriodicDelay">200</int>
<int key="NSPeriodicInterval">25</int>
</object>
</object>
<object class="NSButton" id="583065641">
<reference key="NSNextResponder" ref="177694051"/>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{247, 43}, {117, 18}}</string>
<reference key="NSSuperview" ref="177694051"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="493411239"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="933414996">
<int key="NSCellFlags">67239424</int>
<int key="NSCellFlags2">0</int>
<string key="NSContents">Force selection</string>
<reference key="NSSupport" ref="64180879"/>
<reference key="NSControlView" ref="583065641"/>
<int key="NSButtonFlags">1211912703</int>
<int key="NSButtonFlags2">2</int>
<reference key="NSNormalImage" ref="887534559"/>
<reference key="NSAlternateImage" ref="286406562"/>
<string key="NSAlternateContents"/>
<string key="NSKeyEquivalent"/>
<int key="NSPeriodicDelay">200</int>
<int key="NSPeriodicInterval">25</int>
</object>
</object>
<object class="NSButton" id="493411239">
<reference key="NSNextResponder" ref="177694051"/>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{247, 18}, {129, 18}}</string>
<reference key="NSSuperview" ref="177694051"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="626840863">
<int key="NSCellFlags">-2080244224</int>
<int key="NSCellFlags2">0</int>
<string key="NSContents">Vertical scrollbar</string>
<reference key="NSSupport" ref="64180879"/>
<reference key="NSControlView" ref="493411239"/>
<int key="NSButtonFlags">1211912703</int>
<int key="NSButtonFlags2">2</int>
<reference key="NSNormalImage" ref="887534559"/>
<reference key="NSAlternateImage" ref="286406562"/>
<string key="NSAlternateContents"/>
<string key="NSKeyEquivalent"/>
<int key="NSPeriodicDelay">200</int>
<int key="NSPeriodicInterval">25</int>
</object>
</object>
<object class="NSTextField" id="846797034">
<reference key="NSNextResponder" ref="177694051"/>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{20, 66}, {188, 22}}</string>
<reference key="NSSuperview" ref="177694051"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="121703403"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="1022071393">
<int key="NSCellFlags">-1804468671</int>
<int key="NSCellFlags2">272630784</int>
<string key="NSContents"/>
<reference key="NSSupport" ref="64180879"/>
<string key="NSPlaceholderString"/>
<reference key="NSControlView" ref="846797034"/>
<bool key="NSDrawsBackground">YES</bool>
<reference key="NSBackgroundColor" ref="1070974640"/>
<object class="NSColor" key="NSTextColor">
<int key="NSColorSpace">6</int>
<string key="NSCatalogName">System</string>
<string key="NSColorName">textColor</string>
<reference key="NSColor" ref="804288982"/>
</object>
</object>
</object>
</object>
<string key="NSFrameSize">{394, 166}</string>
<reference key="NSSuperview"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="584113036"/>
</object>
<string key="NSScreenRect">{{0, 0}, {1920, 1178}}</string>
<string key="NSMaxSize">{10000000000000, 10000000000000}</string>
<bool key="NSWindowIsRestorable">YES</bool>
</object>
</object>
<object class="IBObjectContainer" key="IBDocument.Objects">
<object class="NSMutableArray" key="connectionRecords">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">delegate</string>
<reference key="source" ref="1021"/>
<reference key="destination" ref="635946545"/>
</object>
<int key="connectionID">451</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">theWindow</string>
<reference key="source" ref="635946545"/>
<reference key="destination" ref="739395868"/>
</object>
<int key="connectionID">464</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">cibCombo</string>
<reference key="source" ref="635946545"/>
<reference key="destination" ref="584113036"/>
</object>
<int key="connectionID">529</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">comboTarget</string>
<reference key="source" ref="635946545"/>
<reference key="destination" ref="846797034"/>
</object>
<int key="connectionID">577</int>
</object>
<object class="IBConnectionRecord">
<object class="IBBindingConnection" key="connection">
<string key="label">enabled: selection</string>
<reference key="source" ref="584113036"/>
<reference key="destination" ref="412838899"/>
<object class="NSNibBindingConnector" key="connector">
<reference key="NSSource" ref="584113036"/>
<reference key="NSDestination" ref="412838899"/>
<string key="NSLabel">enabled: selection</string>
<string key="NSBinding">enabled</string>
<string key="NSKeyPath">selection</string>
<int key="NSNibBindingConnectorVersion">2</int>
</object>
</object>
<int key="connectionID">522</int>
</object>
<object class="IBConnectionRecord">
<object class="IBBindingConnection" key="connection">
<string key="label">value: cibCombo.enabled</string>
<reference key="source" ref="288514536"/>
<reference key="destination" ref="635946545"/>
<object class="NSNibBindingConnector" key="connector">
<reference key="NSSource" ref="288514536"/>
<reference key="NSDestination" ref="635946545"/>
<string key="NSLabel">value: cibCombo.enabled</string>
<string key="NSBinding">value</string>
<string key="NSKeyPath">cibCombo.enabled</string>
<int key="NSNibBindingConnectorVersion">2</int>
</object>
</object>
<int key="connectionID">531</int>
</object>
<object class="IBConnectionRecord">
<object class="IBBindingConnection" key="connection">
<string key="label">contentObject: combo</string>
<reference key="source" ref="412838899"/>
<reference key="destination" ref="635946545"/>
<object class="NSNibBindingConnector" key="connector">
<reference key="NSSource" ref="412838899"/>
<reference key="NSDestination" ref="635946545"/>
<string key="NSLabel">contentObject: combo</string>
<string key="NSBinding">contentObject</string>
<string key="NSKeyPath">combo</string>
<int key="NSNibBindingConnectorVersion">2</int>
</object>
</object>
<int key="connectionID">521</int>
</object>
<object class="IBConnectionRecord">
<object class="IBBindingConnection" key="connection">
<string key="label">value: cibCombo.completes</string>
<reference key="source" ref="121703403"/>
<reference key="destination" ref="635946545"/>
<object class="NSNibBindingConnector" key="connector">
<reference key="NSSource" ref="121703403"/>
<reference key="NSDestination" ref="635946545"/>
<string key="NSLabel">value: cibCombo.completes</string>
<string key="NSBinding">value</string>
<string key="NSKeyPath">cibCombo.completes</string>
<int key="NSNibBindingConnectorVersion">2</int>
</object>
</object>
<int key="connectionID">535</int>
</object>
<object class="IBConnectionRecord">
<object class="IBBindingConnection" key="connection">
<string key="label">value: cibCombo.forceSelection</string>
<reference key="source" ref="583065641"/>
<reference key="destination" ref="635946545"/>
<object class="NSNibBindingConnector" key="connector">
<reference key="NSSource" ref="583065641"/>
<reference key="NSDestination" ref="635946545"/>
<string key="NSLabel">value: cibCombo.forceSelection</string>
<string key="NSBinding">value</string>
<string key="NSKeyPath">cibCombo.forceSelection</string>
<int key="NSNibBindingConnectorVersion">2</int>
</object>
</object>
<int key="connectionID">548</int>
</object>
<object class="IBConnectionRecord">
<object class="IBBindingConnection" key="connection">
<string key="label">value: cibCombo.hasVerticalScroller</string>
<reference key="source" ref="493411239"/>
<reference key="destination" ref="635946545"/>
<object class="NSNibBindingConnector" key="connector">
<reference key="NSSource" ref="493411239"/>
<reference key="NSDestination" ref="635946545"/>
<string key="NSLabel">value: cibCombo.hasVerticalScroller</string>
<string key="NSBinding">value</string>
<string key="NSKeyPath">cibCombo.hasVerticalScroller</string>
<int key="NSNibBindingConnectorVersion">2</int>
</object>
</object>
<int key="connectionID">546</int>
</object>
<object class="IBConnectionRecord">
<object class="IBBindingConnection" key="connection">
<string key="label">value: cibCombo.buttonBordered</string>
<reference key="source" ref="104434533"/>
<reference key="destination" ref="635946545"/>
<object class="NSNibBindingConnector" key="connector">
<reference key="NSSource" ref="104434533"/>
<reference key="NSDestination" ref="635946545"/>
<string key="NSLabel">value: cibCombo.buttonBordered</string>
<string key="NSBinding">value</string>
<string key="NSKeyPath">cibCombo.buttonBordered</string>
<int key="NSNibBindingConnectorVersion">2</int>
</object>
</object>
<int key="connectionID">552</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">takeStringValueFrom:</string>
<reference key="source" ref="846797034"/>
<reference key="destination" ref="584113036"/>
</object>
<int key="connectionID">578</int>
</object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBObjectRecord">
<int key="objectID">0</int>
<object class="NSArray" key="object" id="0">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<reference key="children" ref="1048"/>
<nil key="parent"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">-2</int>
<reference key="object" ref="1021"/>
<reference key="parent" ref="0"/>
<string key="objectName">File's Owner</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">-1</int>
<reference key="object" ref="1014"/>
<reference key="parent" ref="0"/>
<string key="objectName">First Responder</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">-3</int>
<reference key="object" ref="1050"/>
<reference key="parent" ref="0"/>
<string key="objectName">Application</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">450</int>
<reference key="object" ref="635946545"/>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">460</int>
<reference key="object" ref="739395868"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="177694051"/>
</object>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">461</int>
<reference key="object" ref="177694051"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="584113036"/>
<reference ref="288514536"/>
<reference ref="121703403"/>
<reference ref="583065641"/>
<reference ref="493411239"/>
<reference ref="104434533"/>
<reference ref="846797034"/>
</object>
<reference key="parent" ref="739395868"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">462</int>
<reference key="object" ref="584113036"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="58512575"/>
</object>
<reference key="parent" ref="177694051"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">463</int>
<reference key="object" ref="58512575"/>
<reference key="parent" ref="584113036"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">515</int>
<reference key="object" ref="288514536"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="132463171"/>
</object>
<reference key="parent" ref="177694051"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">516</int>
<reference key="object" ref="132463171"/>
<reference key="parent" ref="288514536"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">517</int>
<reference key="object" ref="412838899"/>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">532</int>
<reference key="object" ref="121703403"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="794409030"/>
</object>
<reference key="parent" ref="177694051"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">533</int>
<reference key="object" ref="794409030"/>
<reference key="parent" ref="121703403"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">536</int>
<reference key="object" ref="583065641"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="933414996"/>
</object>
<reference key="parent" ref="177694051"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">537</int>
<reference key="object" ref="933414996"/>
<reference key="parent" ref="583065641"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">539</int>
<reference key="object" ref="493411239"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="626840863"/>
</object>
<reference key="parent" ref="177694051"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">540</int>
<reference key="object" ref="626840863"/>
<reference key="parent" ref="493411239"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">549</int>
<reference key="object" ref="104434533"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="299849276"/>
</object>
<reference key="parent" ref="177694051"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">550</int>
<reference key="object" ref="299849276"/>
<reference key="parent" ref="104434533"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">573</int>
<reference key="object" ref="846797034"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="1022071393"/>
</object>
<reference key="parent" ref="177694051"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">574</int>
<reference key="object" ref="1022071393"/>
<reference key="parent" ref="846797034"/>
</object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>-1.IBPluginDependency</string>
<string>-2.IBPluginDependency</string>
<string>-3.IBPluginDependency</string>
<string>450.IBPluginDependency</string>
<string>460.IBPluginDependency</string>
<string>460.IBWindowTemplateEditedContentRect</string>
<string>460.NSWindowTemplate.visibleAtLaunch</string>
<string>461.IBPluginDependency</string>
<string>462.IBPluginDependency</string>
<string>463.IBComboBoxObjectValuesKey.objectValues</string>
<string>463.IBPluginDependency</string>
<string>515.IBPluginDependency</string>
<string>516.IBPluginDependency</string>
<string>517.IBPluginDependency</string>
<string>532.IBPluginDependency</string>
<string>533.IBPluginDependency</string>
<string>536.IBPluginDependency</string>
<string>537.IBPluginDependency</string>
<string>539.IBPluginDependency</string>
<string>540.IBPluginDependency</string>
<string>549.IBPluginDependency</string>
<string>550.IBPluginDependency</string>
<string>573.IBPluginDependency</string>
<string>574.IBPluginDependency</string>
</object>
<object class="NSArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>{{357, 418}, {480, 270}}</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<object class="NSArray">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>Moe</string>
<string>Larry</string>
<string>Cheese</string>
<string>Curly</string>
<string>Shemp</string>
<string>Groucho</string>
<string>Harpo</string>
<string>Chico</string>
<string>Zeppo</string>
</object>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
</object>
</object>
<object class="NSMutableDictionary" key="unlocalizedProperties">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference key="dict.sortedKeys" ref="0"/>
<reference key="dict.values" ref="0"/>
</object>
<nil key="activeLocalization"/>
<object class="NSMutableDictionary" key="localizations">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference key="dict.sortedKeys" ref="0"/>
<reference key="dict.values" ref="0"/>
</object>
<nil key="sourceID"/>
<int key="maxID">578</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBPartialClassDescription">
<string key="className">AppController</string>
<string key="superclassName">NSObject</string>
<object class="NSMutableDictionary" key="outlets">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>cibCombo</string>
<string>comboTarget</string>
<string>theWindow</string>
</object>
<object class="NSArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>NSComboBox</string>
<string>NSTextField</string>
<string>NSWindow</string>
</object>
</object>
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>cibCombo</string>
<string>comboTarget</string>
<string>theWindow</string>
</object>
<object class="NSArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBToOneOutletInfo">
<string key="name">cibCombo</string>
<string key="candidateClassName">NSComboBox</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">comboTarget</string>
<string key="candidateClassName">NSTextField</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">theWindow</string>
<string key="candidateClassName">NSWindow</string>
</object>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/AppController.h</string>
</object>
</object>
</object>
</object>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.macosx</string>
<integer value="1050" key="NS.object.0"/>
</object>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3</string>
<integer value="3000" key="NS.object.0"/>
</object>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
<object class="NSMutableDictionary" key="IBDocument.LastKnownImageSizes">
<string key="NS.key.0">NSSwitch</string>
<string key="NS.object.0">{15, 15}</string>
</object>
</data>
</archive>
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

@@ -0,0 +1,103 @@
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!--
index-debug.html
CPComboBoxTest
Created by aparajita on August 8, 2011.
Copyright 2011, Victory-Heart Productions All rights reserved.
-->
<head>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7, chrome=1" />
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<link rel="apple-touch-icon" href="Resources/icon.png" />
<link rel="apple-touch-startup-image" href="Resources/default.png" />
<title>CPComboBoxTest</title>
<script type="text/javascript">
OBJJ_MAIN_FILE = "main.j";
OBJJ_INCLUDE_PATHS = ["Frameworks/Debug", "Frameworks", "SomethingElse"];
</script>
<script src="Frameworks/Debug/Objective-J/Objective-J.js" type="text/javascript" charset="UTF-8"></script>
<script type="text/javascript">
objj_msgSend_reset();
// DEBUG OPTIONS:
// Uncomment to enable printing of backtraces on exceptions:
//objj_msgSend_decorate(objj_backtrace_decorator);
// Uncomment to supress exceptions that take place inside a message
//objj_msgSend_decorate(objj_supress_exceptions_decorator)
// Uncomment to enable runtime type checking:
//objj_msgSend_decorate(objj_typecheck_decorator);
// Uncomment (along with both above) to print backtraces on type check errors:
//objj_typecheck_prints_backtrace = true;
// Uncomment to disable the default logger (CPLogConsole if window.console exists, CPLogPopup otherwise):
//CPLogUnregister(CPLogDefault);
// Uncomment to enable a specific logger:
//CPLogRegister(CPLogConsole);
//CPLogRegister(CPLogPopup);
</script>
<style type="text/css">
body{margin:0; padding:0;}
#container {position: absolute; top:50%; left:50%;}
#content {width:800px; text-align:center; margin-left: -400px; height:50px; margin-top:-25px; line-height: 50px;}
#content {font-family: "Helvetica", "Arial", sans-serif; font-size: 18px; color: black; text-shadow: 0px 1px 0px white; }
#loadgraphic {margin-right: 0.2em; margin-bottom:-2px;}
</style>
<!--[if lt IE 7]>
<STYLE type="text/css">
#container { position: relative; top: 50%; }
#content { position: relative;}
</STYLE>
<![endif]-->
</head>
<body style="">
<div id="cappuccino-body">
<div id="loadingcontainer" style="background-color: #eeeeee; overflow:hidden; width:100%; height:100%; position: absolute; top: 0; left: 0;">
<script type="text/javascript">
document.write("<div id='container'><p id='content'>" +
"<img id='loadgraphic' width='16' height='16' src='Resources/spinner.gif' /> " +
"Loading CPComboBoxTest...</p></div>");
</script>
<noscript>
<div id="container">
<div style="width: 440px; padding: 10px 25px 20px 25px; font-family: sans-serif; background-color: #ffffff; position: relative; left: -245px; top: -120px; text-align: center; -moz-border-radius: 20px; -webkit-border-radius: 20px; color: #555555">
<p style="line-height: 1.4em;">JavaScript is required for this site to work correctly but is either disabled or not supported by your browser.</p>
<p style="font-size:120%; padding:10px;"><a href="http://cappuccino.org/noscript">Show me how to enable JavaScript</a></p>
<p style="font-size:80%;">You may want to upgrade to a newer browser while you're at it:</p>
<ul style="margin:0;padding:0; text-align: center; font-size:80%;" >
<li style="display: inline;"><a href="http://www.apple.com/safari/download/">Safari</a></li>
<li style="display: inline;"><a href="http://www.mozilla.com/en-US/firefox/">Firefox</a></li>
<li style="display: inline;"><a href="http://www.google.com/chrome/">Chrome</a></li>
<li style="display: inline;"><a href="http://www.opera.com/download/">Opera</a></li>
<li style="display: inline;"><a href="http://www.microsoft.com/windows/downloads/ie/getitnow.mspx">Internet Explorer</a></li>
</ul>
</div>
</div>
</noscript>
</div>
</div>
</body>
</html>
+78
View File
@@ -0,0 +1,78 @@
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!--
index.html
CPComboBoxTest
Created by aparajita on August 8, 2011.
Copyright 2011, Victory-Heart Productions All rights reserved.
-->
<head>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7, chrome=1" />
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<link rel="apple-touch-icon" href="Resources/icon.png" />
<link rel="apple-touch-startup-image" href="Resources/default.png" />
<title>CPComboBoxTest</title>
<script type="text/javascript">
OBJJ_MAIN_FILE = "main.j";
</script>
<script type="text/javascript" src="Frameworks/Objective-J/Objective-J.js" charset="UTF-8"></script>
<style type="text/css">
body{margin:0; padding:0;}
#container {position: absolute; top:50%; left:50%;}
#content {width:800px; text-align:center; margin-left: -400px; height:50px; margin-top:-25px; line-height: 50px;}
#content {font-family: "Helvetica", "Arial", sans-serif; font-size: 18px; color: black; text-shadow: 0px 1px 0px white; }
#loadgraphic {margin-right: 0.2em; margin-bottom:-2px;}
</style>
<!--[if lt IE 7]>
<STYLE type="text/css">
#container { position: relative; top: 50%; }
#content { position: relative;}
</STYLE>
<![endif]-->
</head>
<body style="">
<div id="cappuccino-body">
<div id="loadingcontainer" style="background-color: #eeeeee; overflow:hidden; width:100%; height:100%; position: absolute; top: 0; left: 0;">
<script type="text/javascript">
document.write("<div id='container'><p id='content'>" +
"<img id='loadgraphic' width='16' height='16' src='Resources/spinner.gif' /> " +
"Loading CPComboBoxTest...</p></div>");
</script>
<noscript>
<div id="container">
<div style="width: 440px; padding: 10px 25px 20px 25px; font-family: sans-serif; background-color: #ffffff; position: relative; left: -245px; top: -120px; text-align: center; -moz-border-radius: 20px; -webkit-border-radius: 20px; color: #555555">
<p style="line-height: 1.4em;">JavaScript is required for this site to work correctly but is either disabled or not supported by your browser.</p>
<p style="font-size:120%; padding:10px;"><a href="http://cappuccino.org/noscript">Show me how to enable JavaScript</a></p>
<p style="font-size:80%;">You may want to upgrade to a newer browser while you're at it:</p>
<ul style="margin:0;padding:0; text-align: center; font-size:80%;" >
<li style="display: inline;"><a href="http://www.apple.com/safari/download/">Safari</a></li>
<li style="display: inline;"><a href="http://www.mozilla.com/en-US/firefox/">Firefox</a></li>
<li style="display: inline;"><a href="http://www.google.com/chrome/">Chrome</a></li>
<li style="display: inline;"><a href="http://www.opera.com/download/">Opera</a></li>
<li style="display: inline;"><a href="http://www.microsoft.com/windows/downloads/ie/getitnow.mspx">Internet Explorer</a></li>
</ul>
</div>
</div>
</noscript>
</div>
</div>
</body>
</html>
+18
View File
@@ -0,0 +1,18 @@
/*
* AppController.j
* test
*
* Created by aparajita on August 19, 2011.
* Copyright 2011, Victory-Heart Productions All rights reserved.
*/
@import <Foundation/Foundation.j>
@import <AppKit/AppKit.j>
@import "AppController.j"
function main(args, namedArgs)
{
CPApplicationMain(args, namedArgs);
}
@@ -0,0 +1,121 @@
/*
* AppController.j
* NewTextField
*
* Created by Aparajita Fishman.
* Copyright (c) 2011, Intalio, 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 <Foundation/CPObject.j>
@implementation AppController : CPObject
{
CPWindow theWindow;
CPMutableArray fields;
}
- (void)applicationDidFinishLaunching:(CPNotification)aNotification
{
theWindow = [[CPWindow alloc] initWithContentRect:CGRectMakeZero() styleMask:CPBorderlessBridgeWindowMask];
fields = [CPMutableArray array];
var field = [CPTextField textFieldWithStringValue:@"" placeholder:@"Text field" width:200];
[fields addObject:field];
[self configureField:field at:50];
field = [CPTextField roundedTextFieldWithStringValue:@"" placeholder:@"Text field" width:200];
[fields addObject:field];
[self configureField:field at:100];
field = [CPTextField textFieldWithStringValue:@"" placeholder:@"Big text field" width:200];
[field setFont:[CPFont systemFontOfSize:16]];
[fields addObject:field];
[self configureField:field at:150];
field = [[CPSearchField alloc] initWithFrame:CPMakeRect(0, 0, 200, 30)];
[fields addObject:field];
[self configureField:field at:200];
field = [[CPTokenField alloc] initWithFrame:CPMakeRect(0, 0, 200, 30)];
[field setEditable:YES];
[field setPlaceholderString:"Type in a token!"];
[field setTokenizingCharacterSet:[CPCharacterSet characterSetWithCharactersInString:@" "]];
[fields addObject:field];
[self configureField:field at:250];
[self makeTableAt:300];
[theWindow orderFront:self];
}
- (void)configureField:(CPTextField)aField at:(int)yCoord
{
var contentView = [theWindow contentView];
[aField setFrameOrigin:CGPointMake(50, yCoord)];
[aField sizeToFit];
[contentView addSubview:aField];
var enabler = [CPCheckBox checkBoxWithTitle:@"Enabled"];
[enabler setFrameOrigin:CGPointMake(50 + 200 + 10, yCoord + 7)];
[enabler setTarget:self];
[enabler setAction:@selector(enableField:)];
[enabler setState:CPOnState];
[enabler setTag:[fields count] - 1];
[contentView addSubview:enabler];
}
- (void)makeTableAt:(int)yCoord
{
var scrollView = [[CPScrollView alloc] initWithFrame:CGRectMake(50, yCoord, 200, 200)],
table = [[CPTableView alloc] initWithFrame:CGRectMake(0, 0, 200, 200)],
column = [[CPTableColumn alloc] initWithIdentifier:@"1"];
[scrollView setBorderType:CPBezelBorder];
[table setDataSource:self];
[table setVerticalMotionCanBeginDrag:NO];
[column setResizingMask:CPTableColumnAutoresizingMask];
[column setEditable:YES];
[table setColumnAutoresizingStyle:CPTableViewLastColumnOnlyAutoresizingStyle];
[table addTableColumn:column];
[[theWindow contentView] addSubview:scrollView];
[scrollView setDocumentView:table];
}
- (void)enableField:(id)sender
{
var field = [fields objectAtIndex:[sender tag]];
[field setEnabled:[sender state] === CPOnState];
}
- (int)numberOfRowsInTableView:(CPTableView)aTableView
{
return 7;
}
- (id)tableView:(CPTableView)aTableView objectValueForTableColumn:(CPTableColumn)column row:(int)row
{
return "Double-click to edit";
}
- (void)tableView:(CPTableView)aTableView setObjectValue:(id)anObject forTableColumn:(CPTableColumn)aTableColumn row:(int)rowIndex
{
}
@end
+12
View File
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CPApplicationDelegateClass</key>
<string>AppController</string>
<key>CPBundleName</key>
<string>NewTextField</string>
<key>CPPrincipalClass</key>
<string>CPApplication</string>
</dict>
</plist>
+93
View File
@@ -0,0 +1,93 @@
/*
* Jakefile
* NewTextField
*
* Created by aparajita on August 10, 2011.
* Copyright 2011, Victory-Heart Productions All rights reserved.
*/
var ENV = require("system").env,
FILE = require("file"),
JAKE = require("jake"),
task = JAKE.task,
FileList = JAKE.FileList,
app = require("cappuccino/jake").app,
configuration = ENV["CONFIG"] || ENV["CONFIGURATION"] || ENV["c"] || "Debug",
OS = require("os");
app ("NewTextField", function(task)
{
task.setBuildIntermediatesPath(FILE.join("Build", "NewTextField.build", configuration));
task.setBuildPath(FILE.join("Build", configuration));
task.setProductName("NewTextField");
task.setIdentifier("com.aparajita.NewTextField");
task.setVersion("1.0");
task.setAuthor("Victory-Heart Productions");
task.setEmail("feedback @nospam@ yourcompany.com");
task.setSummary("NewTextField");
task.setSources((new FileList("**/*.j")).exclude(FILE.join("Build", "**")));
task.setResources(new FileList("Resources/**"));
task.setIndexFilePath("index.html");
task.setInfoPlistPath("Info.plist");
if (configuration === "Debug")
task.setCompilerFlags("-DDEBUG -g");
else
task.setCompilerFlags("-O");
});
task ("default", ["NewTextField"], function()
{
printResults(configuration);
});
task ("build", ["default"]);
task ("debug", function()
{
ENV["CONFIGURATION"] = "Debug";
JAKE.subjake(["."], "build", ENV);
});
task ("release", function()
{
ENV["CONFIGURATION"] = "Release";
JAKE.subjake(["."], "build", ENV);
});
task ("run", ["debug"], function()
{
OS.system(["open", FILE.join("Build", "Debug", "NewTextField", "index.html")]);
});
task ("run-release", ["release"], function()
{
OS.system(["open", FILE.join("Build", "Release", "NewTextField", "index.html")]);
});
task ("deploy", ["release"], function()
{
FILE.mkdirs(FILE.join("Build", "Deployment", "NewTextField"));
OS.system(["press", "-f", FILE.join("Build", "Release", "NewTextField"), FILE.join("Build", "Deployment", "NewTextField")]);
printResults("Deployment")
});
task ("desktop", ["release"], function()
{
FILE.mkdirs(FILE.join("Build", "Desktop", "NewTextField"));
require("cappuccino/nativehost").buildNativeHost(FILE.join("Build", "Release", "NewTextField"), FILE.join("Build", "Desktop", "NewTextField", "NewTextField.app"));
printResults("Desktop")
});
task ("run-desktop", ["desktop"], function()
{
OS.system([FILE.join("Build", "Desktop", "NewTextField", "NewTextField.app", "Contents", "MacOS", "NativeHost"), "-i"]);
});
function printResults(configuration)
{
print("----------------------------");
print(configuration+" app built at path: "+FILE.join("Build", configuration, "NewTextField"));
print("----------------------------");
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

@@ -0,0 +1,107 @@
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!--
index-debug.html
NewTextField
Created by aparajita on August 10, 2011.
Copyright 2011, Victory-Heart Productions All rights reserved.
-->
<head>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7, chrome=1" />
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<link rel="apple-touch-icon" href="Resources/icon.png" />
<link rel="apple-touch-startup-image" href="Resources/default.png" />
<title>NewTextField</title>
<script type="text/javascript">
OBJJ_MAIN_FILE = "main.j";
OBJJ_INCLUDE_PATHS = ["Frameworks/Debug", "Frameworks", "SomethingElse"];
</script>
<script src="Frameworks/Debug/Objective-J/Objective-J.js" type="text/javascript" charset="UTF-8"></script>
<script type="text/javascript">
objj_msgSend_reset();
// DEBUG OPTIONS:
// Uncomment to enable printing of backtraces on exceptions:
//objj_msgSend_decorate(objj_backtrace_decorator);
// Uncomment to supress exceptions that take place inside a message
//objj_msgSend_decorate(objj_supress_exceptions_decorator)
// Uncomment to enable runtime type checking:
//objj_msgSend_decorate(objj_typecheck_decorator);
// Uncomment (along with both above) to print backtraces on type check errors:
//objj_typecheck_prints_backtrace = true;
// Uncomment to disable the default logger (CPLogConsole if window.console exists, CPLogPopup otherwise):
//CPLogUnregister(CPLogDefault);
// Uncomment to enable a specific logger:
//CPLogRegister(CPLogConsole);
//CPLogRegister(CPLogPopup);
// Tag view DOM elements with a "data-cappuccino-view" attribute that contains
// the class name of the view that created them. Comment this or set to false to disable.
appkit_tag_dom_elements = true;
</script>
<style type="text/css">
body{margin:0; padding:0;}
#container {position: absolute; top:50%; left:50%;}
#content {width:800px; text-align:center; margin-left: -400px; height:50px; margin-top:-25px; line-height: 50px;}
#content {font-family: "Helvetica", "Arial", sans-serif; font-size: 18px; color: black; text-shadow: 0px 1px 0px white; }
#loadgraphic {margin-right: 0.2em; margin-bottom:-2px;}
</style>
<!--[if lt IE 7]>
<STYLE type="text/css">
#container { position: relative; top: 50%; }
#content { position: relative;}
</STYLE>
<![endif]-->
</head>
<body style="">
<div id="cappuccino-body">
<div id="loadingcontainer" style="background-color: #eeeeee; overflow:hidden; width:100%; height:100%; position: absolute; top: 0; left: 0;">
<script type="text/javascript">
document.write("<div id='container'><p id='content'>" +
"<img id='loadgraphic' width='16' height='16' src='Resources/spinner.gif' /> " +
"Loading NewTextField...</p></div>");
</script>
<noscript>
<div id="container">
<div style="width: 440px; padding: 10px 25px 20px 25px; font-family: sans-serif; background-color: #ffffff; position: relative; left: -245px; top: -120px; text-align: center; -moz-border-radius: 20px; -webkit-border-radius: 20px; color: #555555">
<p style="line-height: 1.4em;">JavaScript is required for this site to work correctly but is either disabled or not supported by your browser.</p>
<p style="font-size:120%; padding:10px;"><a href="http://cappuccino.org/noscript">Show me how to enable JavaScript</a></p>
<p style="font-size:80%;">You may want to upgrade to a newer browser while you're at it:</p>
<ul style="margin:0;padding:0; text-align: center; font-size:80%;" >
<li style="display: inline;"><a href="http://www.apple.com/safari/download/">Safari</a></li>
<li style="display: inline;"><a href="http://www.mozilla.com/en-US/firefox/">Firefox</a></li>
<li style="display: inline;"><a href="http://www.google.com/chrome/">Chrome</a></li>
<li style="display: inline;"><a href="http://www.opera.com/download/">Opera</a></li>
<li style="display: inline;"><a href="http://www.microsoft.com/windows/downloads/ie/getitnow.mspx">Internet Explorer</a></li>
</ul>
</div>
</div>
</noscript>
</div>
</div>
</body>
</html>
+78
View File
@@ -0,0 +1,78 @@
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!--
index.html
NewTextField
Created by aparajita on August 10, 2011.
Copyright 2011, Victory-Heart Productions All rights reserved.
-->
<head>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7, chrome=1" />
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<link rel="apple-touch-icon" href="Resources/icon.png" />
<link rel="apple-touch-startup-image" href="Resources/default.png" />
<title>NewTextField</title>
<script type="text/javascript">
OBJJ_MAIN_FILE = "main.j";
</script>
<script type="text/javascript" src="Frameworks/Objective-J/Objective-J.js" charset="UTF-8"></script>
<style type="text/css">
body{margin:0; padding:0;}
#container {position: absolute; top:50%; left:50%;}
#content {width:800px; text-align:center; margin-left: -400px; height:50px; margin-top:-25px; line-height: 50px;}
#content {font-family: "Helvetica", "Arial", sans-serif; font-size: 18px; color: black; text-shadow: 0px 1px 0px white; }
#loadgraphic {margin-right: 0.2em; margin-bottom:-2px;}
</style>
<!--[if lt IE 7]>
<STYLE type="text/css">
#container { position: relative; top: 50%; }
#content { position: relative;}
</STYLE>
<![endif]-->
</head>
<body style="">
<div id="cappuccino-body">
<div id="loadingcontainer" style="background-color: #eeeeee; overflow:hidden; width:100%; height:100%; position: absolute; top: 0; left: 0;">
<script type="text/javascript">
document.write("<div id='container'><p id='content'>" +
"<img id='loadgraphic' width='16' height='16' src='Resources/spinner.gif' /> " +
"Loading NewTextField...</p></div>");
</script>
<noscript>
<div id="container">
<div style="width: 440px; padding: 10px 25px 20px 25px; font-family: sans-serif; background-color: #ffffff; position: relative; left: -245px; top: -120px; text-align: center; -moz-border-radius: 20px; -webkit-border-radius: 20px; color: #555555">
<p style="line-height: 1.4em;">JavaScript is required for this site to work correctly but is either disabled or not supported by your browser.</p>
<p style="font-size:120%; padding:10px;"><a href="http://cappuccino.org/noscript">Show me how to enable JavaScript</a></p>
<p style="font-size:80%;">You may want to upgrade to a newer browser while you're at it:</p>
<ul style="margin:0;padding:0; text-align: center; font-size:80%;" >
<li style="display: inline;"><a href="http://www.apple.com/safari/download/">Safari</a></li>
<li style="display: inline;"><a href="http://www.mozilla.com/en-US/firefox/">Firefox</a></li>
<li style="display: inline;"><a href="http://www.google.com/chrome/">Chrome</a></li>
<li style="display: inline;"><a href="http://www.opera.com/download/">Opera</a></li>
<li style="display: inline;"><a href="http://www.microsoft.com/windows/downloads/ie/getitnow.mspx">Internet Explorer</a></li>
</ul>
</div>
</div>
</noscript>
</div>
</div>
</body>
</html>
+18
View File
@@ -0,0 +1,18 @@
/*
* AppController.j
* NewTextField
*
* Created by aparajita on August 10, 2011.
* Copyright 2011, Victory-Heart Productions All rights reserved.
*/
@import <Foundation/Foundation.j>
@import <AppKit/AppKit.j>
@import "AppController.j"
function main(args, namedArgs)
{
CPApplicationMain(args, namedArgs);
}
+1
View File
@@ -31,6 +31,7 @@
@import "NSColorWell.j"
@import "NSCollectionView.j"
@import "NSCollectionViewItem.j"
@import "NSComboBox.j"
@import "NSControl.j"
@import "NSCustomObject.j"
@import "NSCustomResource.j"
+105
View File
@@ -0,0 +1,105 @@
/*
* NSComboBox.j
* nib2cib
*
* Created by Aparajita Fishman.
* Copyright (c) 2012, The Cappuccino Foundation
*
* 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 <AppKit/CPTextField.j>
@import <AppKit/CPComboBox.j>
@import "NSTextField.j"
@implementation CPComboBox (NSCoding)
- (id)NS_initWithCoder:(CPCoder)aCoder
{
self = [super NS_initWithCoder:aCoder];
if (self)
{
var cell = [aCoder decodeObjectForKey:@"NSCell"];
_items = [cell itemList];
_usesDataSource = [cell usesDataSource];
_completes = [cell completes];
_numberOfVisibleItems = [cell visibleItemCount];
_hasVerticalScroller = [cell hasVerticalScroller];
[self setButtonBordered:[cell borderedButton]];
// Make sure the height is clipped to the max given by the theme
var maxSize = [[[Converter sharedConverter] themes][0] valueForAttributeWithName:@"max-size" forClass:[CPComboBox class]],
size = [self frameSize];
[self setFrameSize:CGSizeMake(size.width, MIN(size.height, maxSize.height))];
}
return self;
}
@end
@implementation NSComboBox : CPComboBox
- (id)initWithCoder:(CPCoder)aCoder
{
return [self NS_initWithCoder:aCoder];
}
- (Class)classForKeyedArchiver
{
return [CPComboBox class];
}
@end
@implementation NSComboBoxCell : NSTextFieldCell
{
int _visibleItemCount @accessors(readonly, getter=visibleItemCount);
BOOL _hasVerticalScroller @accessors(readonly, getter=hasVerticalScroller);
BOOL _usesDataSource @accessors(readonly, getter=usesDataSource);
BOOL _completes @accessors(readonly, getter=completes);
CPArray _itemList @accessors(readonly, getter=itemList);
BOOL _borderedButton @accessors(readonly, getter=borderedButton);
}
- (id)initWithCoder:(CPCoder)aCoder
{
self = [super initWithCoder:aCoder];
if (self)
{
_visibleItemCount = [aCoder decodeIntForKey:@"NSVisibleItemCount"];
_hasVerticalScroller = [aCoder decodeBoolForKey:@"NSHasVerticalScroller"];
_usesDataSource = [aCoder decodeBoolForKey:@"NSUsesDataSource"];
_completes = [aCoder decodeBoolForKey:@"NSCompletes"];
if (!_usesDataSource)
_itemList = [aCoder decodeObjectForKey:@"NSPopUpListData"] || [];
else
_itemList = [];
// NSButtonBordered key is present only if the value is NO, go figure
_borderedButton = [aCoder containsValueForKey:@"NSButtonBordered"] ? [aCoder decodeBoolForKey:@"NSButtonBordered"] : YES;
}
return self;
}
@end