Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a7994c1480 | ||
|
|
c605ca4531 | ||
|
|
c288930a3c | ||
|
|
596676a562 | ||
|
|
cc3d9f337c | ||
|
|
8d210100a5 | ||
|
|
d25e96902f | ||
|
|
ad792d9772 | ||
|
|
9e7b737960 | ||
|
|
9bc6a69b76 | ||
|
|
1cb28e4206 | ||
|
|
5311689265 | ||
|
|
4228a2a146 | ||
|
|
bacc50c271 | ||
|
|
da18a9eb24 | ||
|
|
d975e90407 | ||
|
|
abc8e14275 | ||
|
|
b032cd5b7d | ||
|
|
bb589285e3 | ||
|
|
1d52c3e957 | ||
|
|
df5ce9e0f3 | ||
|
|
16b446ae08 | ||
|
|
d0a5b6e1c7 | ||
|
|
271a1ef3b4 | ||
|
|
b91042eb08 | ||
|
|
d40ebaf369 | ||
|
|
06f74e5ef0 | ||
|
|
5eaeb5f05e | ||
|
|
961cb2f6ed | ||
|
|
4dca2bbb85 | ||
|
|
892d3d7120 | ||
|
|
c0fe499937 | ||
|
|
01e8e9e597 | ||
|
|
08b740c36f | ||
|
|
31918bc0cd | ||
|
|
d45aeed224 | ||
|
|
7d2835c522 | ||
|
|
cff26bd4e6 | ||
|
|
936ae1d563 | ||
|
|
3d52935be0 | ||
|
|
777b167a2a | ||
|
|
c5d602bd6d | ||
|
|
8545195cd7 | ||
|
|
74fd73c18d | ||
|
|
2479f15b6b | ||
|
|
75875f4032 | ||
|
|
0752b63b03 | ||
|
|
bde2f20fa3 | ||
|
|
c12305f40a | ||
|
|
2be149c486 | ||
|
|
c7a16deb6f | ||
|
|
1fb8c95b5d | ||
|
|
ad630c840b | ||
|
|
16b52035c1 | ||
|
|
e98cd9e069 | ||
|
|
e99f7261f3 | ||
|
|
85b370e6cf | ||
|
|
c5ab90ae52 | ||
|
|
776cdf93fe | ||
|
|
2bbba19aba | ||
|
|
635a57b036 | ||
|
|
5b231867dc | ||
|
|
6eee5543f9 | ||
|
|
1918528710 | ||
|
|
b007f9899d | ||
|
|
8a460b65ed | ||
|
|
8fa12b874e | ||
|
|
a9edc868f1 | ||
|
|
7e465689e4 | ||
|
|
1cab9463ad | ||
|
|
3974a483d1 | ||
|
|
ecf8f7b143 | ||
|
|
f57755ce46 | ||
|
|
eaa51835ef | ||
|
|
9038b7cfa9 | ||
|
|
8dd174d1e3 | ||
|
|
b9b0eb79d8 | ||
|
|
a5832aa66b | ||
|
|
9472f76ad5 | ||
|
|
4da5669ecb | ||
|
|
c232680600 | ||
|
|
bd25b6fb48 | ||
|
|
834d878a4d | ||
|
|
4cb5ccbc3a | ||
|
|
929cd78bae | ||
|
|
f5961b9e06 | ||
|
|
7fb17e9f41 | ||
|
|
dd70bdc698 | ||
|
|
59d619d190 | ||
|
|
dd160d6bed | ||
|
|
ae5a2c4164 | ||
|
|
a939bed8e0 | ||
|
|
c686a4384b | ||
|
|
6bb2dd2a16 | ||
|
|
2ec574173a | ||
|
|
743feb5360 | ||
|
|
bc4dc041e5 | ||
|
|
8c8d1ae3d3 | ||
|
|
a9781016be | ||
|
|
4be0bb3a30 | ||
|
|
a74267e937 | ||
|
|
6dea853ef3 | ||
|
|
94df530580 | ||
|
|
d038c50531 | ||
|
|
83546d58db | ||
|
|
8de587d4fc | ||
|
|
bd9a6ea150 | ||
|
|
fe69142567 | ||
|
|
5f85f7bef1 | ||
|
|
397e314cc9 | ||
|
|
c87d96676c | ||
|
|
13d4e36d39 | ||
|
|
a5c06c8f27 | ||
|
|
76bdbb660e | ||
|
|
a7929e6c1e | ||
|
|
b3cbc7e362 | ||
|
|
d6b3efaae8 | ||
|
|
33345f65ce | ||
|
|
3fe5ec5d6d | ||
|
|
142b982577 | ||
|
|
147c65b962 | ||
|
|
89dbccd74e | ||
|
|
a4647f2b82 | ||
|
|
94336ebcbb | ||
|
|
5dfa43ce5f | ||
|
|
ff7774976e | ||
|
|
a435e54a67 | ||
|
|
852597f11d | ||
|
|
806fea9222 | ||
|
|
972bb4100f | ||
|
|
6a6b83635f | ||
|
|
d8f202fc1f | ||
|
|
2322743252 | ||
|
|
8b3f9c5557 | ||
|
|
b573daf59b | ||
|
|
4f8fa778d5 | ||
|
|
30d5a7f7a2 | ||
|
|
b01a4436b6 | ||
|
|
9ad8f75a08 | ||
|
|
2bf9afa97a | ||
|
|
9e892d4eea | ||
|
|
d2407d1c2a | ||
|
|
17dc96ad2f | ||
|
|
b3a427ba18 | ||
|
|
4cdefcc2c7 | ||
|
|
b7c0dcf050 | ||
|
|
fe9573e5b8 | ||
|
|
9fcf0258e0 | ||
|
|
e22faa0d79 | ||
|
|
175b204bb6 | ||
|
|
b126b2946d | ||
|
|
fec200c835 | ||
|
|
ea0a47a845 | ||
|
|
835d89774a | ||
|
|
f0a2a91837 | ||
|
|
8614bab724 | ||
|
|
9c181cc9c9 | ||
|
|
a0a7b126ab | ||
|
|
78ddc2db70 | ||
|
|
e80cbc89b2 | ||
|
|
c0f5ed1f87 | ||
|
|
51a8975f0a |
@@ -9,3 +9,4 @@ WebSite
|
||||
*.xcodeproj/*.perspectivev3
|
||||
xcuserdata/
|
||||
!*.xcodeproj/project.pbxproj
|
||||
target
|
||||
|
||||
@@ -37,12 +37,14 @@
|
||||
@import "CPCibControlConnector.j"
|
||||
@import "CPCibLoading.j"
|
||||
@import "CPCibOutletConnector.j"
|
||||
@import "CPCibRuntimeAttributesConnector.j"
|
||||
@import "CPClipView.j"
|
||||
@import "CPCollectionView.j"
|
||||
@import "CPCollectionViewItem.j"
|
||||
@import "CPColor.j"
|
||||
@import "CPColorPanel.j"
|
||||
@import "CPColorWell.j"
|
||||
@import "CPComboBox.j"
|
||||
@import "CPCompatibility.j"
|
||||
@import "CPControl.j"
|
||||
@import "CPCookie.j"
|
||||
|
||||
@@ -107,7 +107,7 @@ CPRunContinuesResponse = -1002;
|
||||
|
||||
CPPanel _aboutPanel;
|
||||
|
||||
CPThemeBlend _themeBlend @accessors(property=themeBlend);
|
||||
CPArray _themeBlends @accessors(property=themeBlends);
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -141,6 +141,8 @@ CPRunContinuesResponse = -1002;
|
||||
_windows = [];
|
||||
|
||||
[_windows addObject:nil];
|
||||
|
||||
_themeBlends = [];
|
||||
}
|
||||
|
||||
return self;
|
||||
@@ -338,7 +340,7 @@ CPRunContinuesResponse = -1002;
|
||||
Copyright - Human readable copyright information.
|
||||
</pre>
|
||||
|
||||
If you choose not the include any of the above keys, they will default
|
||||
If you choose not the include any of the above keys, they will default
|
||||
to the following respective keys in your info.plist file.
|
||||
|
||||
<pre>
|
||||
@@ -1003,7 +1005,7 @@ CPRunContinuesResponse = -1002;
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the arguments of your application.
|
||||
Sets the arguments of your application.
|
||||
That is, set the slash seperated values of an array as the window location hash.
|
||||
|
||||
For example if you pass an array:
|
||||
@@ -1156,6 +1158,16 @@ CPRunContinuesResponse = -1002;
|
||||
userInfo:nil];
|
||||
}
|
||||
|
||||
- (CPThemeBlend)themeBlend
|
||||
{
|
||||
return (_themeBlends.length > 0 ? _themeBlends[0] : nil);
|
||||
}
|
||||
|
||||
- (void)setThemeBlend:(CPThemeBlend)aThemeBlend
|
||||
{
|
||||
_themeBlends[0] = aThemeBlend;
|
||||
}
|
||||
|
||||
+ (CPString)defaultThemeName
|
||||
{
|
||||
return ([[CPBundle mainBundle] objectForInfoDictionaryKey:"CPDefaultTheme"] || @"Aristo");
|
||||
@@ -1218,15 +1230,14 @@ function CPApplicationMain(args, namedArgs)
|
||||
[_CPAppBootstrapper performActions];
|
||||
}
|
||||
|
||||
var _CPAppBootstrapperActions = nil;
|
||||
var _CPAppBootstrapperActions = nil,
|
||||
_CPAppThemeURLsToLoad = [];
|
||||
|
||||
@implementation _CPAppBootstrapper : CPObject
|
||||
{
|
||||
}
|
||||
|
||||
+ (CPArray)actions
|
||||
{
|
||||
return [@selector(bootstrapPlatform), @selector(loadDefaultTheme), @selector(loadMainCibFile)];
|
||||
return [@selector(bootstrapPlatform), @selector(loadThemes), @selector(loadMainCibFile)];
|
||||
}
|
||||
|
||||
+ (void)performActions
|
||||
@@ -1250,17 +1261,30 @@ var _CPAppBootstrapperActions = nil;
|
||||
return [CPPlatform bootstrap];
|
||||
}
|
||||
|
||||
+ (BOOL)loadDefaultTheme
|
||||
+ (BOOL)loadThemes
|
||||
{
|
||||
var defaultThemeName = [CPApplication defaultThemeName],
|
||||
themeURL = nil;
|
||||
_CPAppThemeURLsToLoad.push([CPApplication defaultThemeName]);
|
||||
|
||||
if (defaultThemeName === @"Aristo")
|
||||
themeURL = [[CPBundle bundleForClass:[CPApplication class]] pathForResource:defaultThemeName + @".blend"];
|
||||
var auxiliaryThemes = ([[CPBundle mainBundle] objectForInfoDictionaryKey:@"CPAuxiliaryThemes"] || []);
|
||||
|
||||
_CPAppThemeURLsToLoad = _CPAppThemeURLsToLoad.concat(auxiliaryThemes);
|
||||
|
||||
[self loadNextTheme];
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
+ (BOOL)loadNextTheme
|
||||
{
|
||||
var themeName = _CPAppThemeURLsToLoad.shift();
|
||||
|
||||
if (themeName === @"Aristo")
|
||||
themeURL = [[CPBundle bundleForClass:[CPApplication class]] pathForResource:themeName + @".blend"];
|
||||
else
|
||||
themeURL = [[CPBundle mainBundle] pathForResource:defaultThemeName + @".blend"];
|
||||
themeURL = [[CPBundle mainBundle] pathForResource:themeName + @".blend"];
|
||||
|
||||
var blend = [[CPThemeBlend alloc] initWithContentsOfURL:themeURL];
|
||||
|
||||
[blend loadWithDelegate:self];
|
||||
|
||||
return YES;
|
||||
@@ -1268,10 +1292,17 @@ var _CPAppBootstrapperActions = nil;
|
||||
|
||||
+ (void)blendDidFinishLoading:(CPThemeBlend)aThemeBlend
|
||||
{
|
||||
[[CPApplication sharedApplication] setThemeBlend:aThemeBlend];
|
||||
[CPTheme setDefaultTheme:[CPTheme themeNamed:[CPApplication defaultThemeName]]];
|
||||
var themeBlends = [CPApp themeBlends];
|
||||
|
||||
[self performActions];
|
||||
[themeBlends addObject:aThemeBlend];
|
||||
|
||||
if ([themeBlends count] === 1)
|
||||
[CPTheme setDefaultTheme:[CPTheme themeNamed:[CPApplication defaultThemeName]]];
|
||||
|
||||
if (_CPAppThemeURLsToLoad.length === 0)
|
||||
[self performActions];
|
||||
else
|
||||
[self loadNextTheme];
|
||||
}
|
||||
|
||||
+ (BOOL)loadMainCibFile
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
@import "CPCompatibility.j"
|
||||
@import "CPImage.j"
|
||||
|
||||
/// @cond IGNORE
|
||||
|
||||
var _redComponent = 0,
|
||||
_greenComponent = 1,
|
||||
@@ -54,6 +55,66 @@ var cachedBlackColor,
|
||||
cachedShadowColor,
|
||||
cachedClearColor;
|
||||
|
||||
/// @endcond
|
||||
|
||||
/*!
|
||||
Orientation to use with \c CPColorPattern for vertical patterns.
|
||||
*/
|
||||
CPColorPatternIsVertical = YES,
|
||||
|
||||
/*!
|
||||
Orientation to use with \c CPColorPattern for horizontal patterns.
|
||||
*/
|
||||
CPColorPatternIsHorizontal = NO;
|
||||
|
||||
/*!
|
||||
To create a simple color with a pattern image:
|
||||
|
||||
<code>CPColorWithImages(name, width, height{, bundle})</code>
|
||||
|
||||
To create a color with a three part pattern image:
|
||||
|
||||
<code>CPColorWithImages(slices{, orientation})</code>
|
||||
|
||||
where slices is an array of three [name, width, height{, bundle}] arrays,
|
||||
and orientation is \c CPColorPatternIsVertical or \ref CPColorPatternIsHorizontal.
|
||||
If orientatation is not passed, it defaults to \ref CPColorPatternIsHorizontal.
|
||||
|
||||
To create a color with a nine part pattern image:
|
||||
|
||||
<code>CPColorWithImages(slices);</code>
|
||||
|
||||
where slices is an array of nine [name, width, height{, bundle}] arrays.
|
||||
*/
|
||||
function CPColorWithImages()
|
||||
{
|
||||
if (arguments.length < 3)
|
||||
{
|
||||
var slices = arguments[0],
|
||||
imageSlices = [];
|
||||
|
||||
for (var i = 0; i < slices.length; ++i)
|
||||
{
|
||||
var slice = slices[i];
|
||||
|
||||
imageSlices.push(slice ? CPImageInBundle(slice[0], CGSizeMake(slice[1], slice[2]), slice[3]) : nil);
|
||||
}
|
||||
|
||||
if (imageSlices.length === 3)
|
||||
return [CPColor colorWithPatternImage:[[CPThreePartImage alloc] initWithImageSlices:imageSlices isVertical:arguments[1] || CPColorPatternIsHorizontal]];
|
||||
else
|
||||
return [CPColor colorWithPatternImage:[[CPNinePartImage alloc] initWithImageSlices:imageSlices]];
|
||||
}
|
||||
else if (arguments.length === 3 || arguments.length === 4)
|
||||
{
|
||||
return [CPColor colorWithPatternImage:CPImageInBundle(arguments[0], CGSizeMake(arguments[1], arguments[2]), arguments[3])];
|
||||
}
|
||||
else
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
@ingroup appkit
|
||||
|
||||
@@ -633,7 +694,36 @@ url("data:image/png;base64,BASE64ENCODEDDATA") // if there is a pattern image
|
||||
|
||||
- (CPString)description
|
||||
{
|
||||
return [super description]+" "+[self cssString];
|
||||
var description = [super description],
|
||||
patternImage = [self patternImage];
|
||||
|
||||
if (!patternImage)
|
||||
return description + " " + [self cssString];
|
||||
|
||||
description += " {\n";
|
||||
|
||||
if ([patternImage isThreePartImage] || [patternImage isNinePartImage])
|
||||
{
|
||||
var slices = [patternImage imageSlices];
|
||||
|
||||
if ([patternImage isThreePartImage])
|
||||
description += " orientation: " + ([patternImage isVertical] ? "vertical" : "horizontal") + ",\n";
|
||||
|
||||
description += " patternImage (" + slices.length + " part): [\n";
|
||||
|
||||
for (var i = 0; i < slices.length; ++i)
|
||||
{
|
||||
var imgDescription = [slices[i] description];
|
||||
|
||||
description += imgDescription.replace(/^/mg, " ") + ",\n";
|
||||
}
|
||||
|
||||
description = description.substr(0, description.length - 2) + "\n ]\n}";
|
||||
}
|
||||
else
|
||||
description += [patternImage description].replace(/^/mg, " ") + "\n}";
|
||||
|
||||
return description;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -678,8 +768,10 @@ url("data:image/png;base64,BASE64ENCODEDDATA") // if there is a pattern image
|
||||
|
||||
@end
|
||||
|
||||
/// @cond IGNORE
|
||||
var CPColorComponentsKey = @"CPColorComponentsKey",
|
||||
CPColorPatternImageKey = @"CPColorPatternImageKey";
|
||||
/// @endcond
|
||||
|
||||
@implementation CPColor (CPCoding)
|
||||
|
||||
@@ -710,13 +802,12 @@ var CPColorComponentsKey = @"CPColorComponentsKey",
|
||||
@end
|
||||
|
||||
|
||||
/// @cond IGNORE
|
||||
var hexCharacters = "0123456789ABCDEF";
|
||||
|
||||
/*!
|
||||
Used for the CPColor \c +colorWithHexString: implementation
|
||||
@ignore
|
||||
@class CPColor
|
||||
@return an array of rgb components
|
||||
/*
|
||||
Used for the CPColor +colorWithHexString: implementation.
|
||||
Returns an array of rgb components.
|
||||
*/
|
||||
var hexToRGB = function(hex)
|
||||
{
|
||||
@@ -754,3 +845,5 @@ var byteToHex = function(n)
|
||||
return hexCharacters.charAt((n - n % 16) / 16) +
|
||||
hexCharacters.charAt(n % 16);
|
||||
};
|
||||
|
||||
/// @endcond
|
||||
|
||||
@@ -526,7 +526,7 @@ var CPControlBlackColor = [CPColor blackColor];
|
||||
// Cocoa raises an invalid parameter assertion and returns if you pass nil.
|
||||
if (aString === nil || aString === undefined)
|
||||
{
|
||||
CPLog.warn("nil sent to CPControl -setStringValue");
|
||||
CPLog.warn("nil or undefined sent to CPControl -setStringValue");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -536,10 +536,10 @@ var CPControlBlackColor = [CPColor blackColor];
|
||||
{
|
||||
value = nil;
|
||||
|
||||
if ([_formatter getObjectValue:AT_REF(value) forString:aString errorDescription:nil] === NO)
|
||||
if (![_formatter getObjectValue:AT_REF(value) forString:aString errorDescription:nil])
|
||||
{
|
||||
// If the given string is non-empty and doesn't work, Cocoa tries an empty string.
|
||||
if (!aString || [_formatter getObjectValue:AT_REF(value) forString:@"" errorDescription:nil] === NO)
|
||||
if (!aString || ![_formatter getObjectValue:AT_REF(value) forString:@"" errorDescription:nil])
|
||||
value = undefined; // Means the value is invalid
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,7 +44,8 @@ CPImageNameColorPanel = @"CPImageNameColorPanel";
|
||||
CPImageNameColorPanelHighlighted = @"CPImageNameColorPanelHighlighted";
|
||||
|
||||
var imagesForNames = { },
|
||||
AppKitImageForNames = { };
|
||||
AppKitImageForNames = { },
|
||||
ImageDescriptionFormat = "%s {\n filename: \"%s\",\n size: { width:%f, height:%f }\n}";
|
||||
|
||||
AppKitImageForNames[CPImageNameColorPanel] = CGSizeMake(26.0, 29.0);
|
||||
AppKitImageForNames[CPImageNameColorPanelHighlighted] = CGSizeMake(26.0, 29.0);
|
||||
@@ -324,6 +325,24 @@ function CPAppKitImage(aFilename, aSize)
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (CPString)description
|
||||
{
|
||||
var filename = [self filename],
|
||||
size = [self size];
|
||||
|
||||
if (filename.indexOf("data:") === 0)
|
||||
{
|
||||
var index = filename.indexOf(",");
|
||||
|
||||
if (index > 0)
|
||||
filename = [CPString stringWithFormat:@"%s,%s...%s", filename.substr(0, index), filename.substr(index + 1, 10), filename.substr(filename.length - 10)];
|
||||
else
|
||||
filename = "data:<unknown type>";
|
||||
}
|
||||
|
||||
return [CPString stringWithFormat:ImageDescriptionFormat, [super description], filename, size.width, size.height];
|
||||
}
|
||||
|
||||
/* @ignore */
|
||||
- (void)_derefFromImage
|
||||
{
|
||||
|
||||
@@ -204,7 +204,6 @@ var CPBindingOperationAnd = 0,
|
||||
if (valueTransformer)
|
||||
aValue = [valueTransformer transformedValue:aValue];
|
||||
|
||||
|
||||
if (aValue === undefined || aValue === nil || aValue === [CPNull null])
|
||||
aValue = [options objectForKey:CPNullPlaceholderBindingOption] || nil;
|
||||
|
||||
@@ -311,7 +310,7 @@ var CPBindingOperationAnd = 0,
|
||||
- (void)bind:(CPString)aBinding toObject:(id)anObject withKeyPath:(CPString)aKeyPath options:(CPDictionary)options
|
||||
{
|
||||
if (!anObject || !aKeyPath)
|
||||
return CPLog.error("Invalid object or path on "+self+" for "+aBinding);
|
||||
return CPLog.error("Invalid object or path on " + self + " for " + aBinding);
|
||||
|
||||
//if (![[self exposedBindings] containsObject:aBinding])
|
||||
// CPLog.warn("No binding exposed on "+self+" for "+aBinding);
|
||||
@@ -488,6 +487,8 @@ CPSelectedIndexBinding = @"selectedIndex";
|
||||
CPTextColorBinding = @"textColor";
|
||||
CPToolTipBinding = @"toolTip";
|
||||
CPValueBinding = @"value";
|
||||
CPContentBinding = @"content";
|
||||
CPContentValuesBinding = @"contentValues";
|
||||
|
||||
//Binding options constants
|
||||
CPAllowsEditingMultipleValuesSelectionBindingOption = @"CPAllowsEditingMultipleValuesSelection";
|
||||
@@ -518,4 +519,4 @@ CPValueTransformerBindingOption = @"CPValueTransformer";
|
||||
CPIsControllerMarker = function(/*id*/anObject)
|
||||
{
|
||||
return anObject === CPMultipleValuesMarker || anObject === CPNoSelectionMarker || anObject === CPNotApplicableMarker || anObject === CPNullMarker;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -323,12 +323,22 @@
|
||||
@ignore
|
||||
*/
|
||||
- (void)_selectionDidChange
|
||||
{
|
||||
[self _selectionDidChangeNotify:YES];
|
||||
}
|
||||
|
||||
/*!
|
||||
@ignore
|
||||
*/
|
||||
- (void)_selectionDidChangeNotify:(BOOL)notify
|
||||
{
|
||||
if (_selection === undefined || _selection === nil)
|
||||
_selection = [[CPControllerSelectionProxy alloc] initWithController:self];
|
||||
|
||||
[_selection controllerDidChange];
|
||||
[self didChangeValueForKey:@"selection"];
|
||||
|
||||
if (notify)
|
||||
[self didChangeValueForKey:@"selection"];
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -666,21 +676,21 @@ var CPObjectControllerContentKey = @"CPObjectControllerCo
|
||||
var count = [theValues count];
|
||||
|
||||
if (!count)
|
||||
value = CPNoSelectionMarker;
|
||||
return CPNoSelectionMarker;
|
||||
else if (count === 1)
|
||||
value = [theValues objectAtIndex:0];
|
||||
else
|
||||
{
|
||||
if ([_controller alwaysUsesMultipleValuesMarker])
|
||||
value = CPMultipleValuesMarker;
|
||||
return CPMultipleValuesMarker;
|
||||
else
|
||||
{
|
||||
value = [theValues objectAtIndex:0];
|
||||
|
||||
for (var i = 0, count= [theValues count]; i < count && value != CPMultipleValuesMarker; i++)
|
||||
for (var i = 0, count = [theValues count]; i < count; i++)
|
||||
{
|
||||
if (![value isEqual:[theValues objectAtIndex:i]])
|
||||
value = CPMultipleValuesMarker;
|
||||
return CPMultipleValuesMarker;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -693,8 +703,21 @@ var CPObjectControllerContentKey = @"CPObjectControllerCo
|
||||
|
||||
- (id)valueForKeyPath:(CPString)theKeyPath
|
||||
{
|
||||
var values = [[_controller selectedObjects] valueForKeyPath:theKeyPath];
|
||||
value = [self _controllerMarkerForValues:values];
|
||||
// If valueForKeyPath fails because of an undefined key, return CPNotApplicableMarker
|
||||
var value;
|
||||
|
||||
try
|
||||
{
|
||||
var values = [[_controller selectedObjects] valueForKeyPath:theKeyPath];
|
||||
value = [self _controllerMarkerForValues:values];
|
||||
}
|
||||
catch (ex)
|
||||
{
|
||||
if ([ex name] === CPUndefinedKeyException)
|
||||
value = CPNotApplicableMarker;
|
||||
else
|
||||
throw ex;
|
||||
}
|
||||
|
||||
[_cachedValues setObject:value forKey:theKeyPath];
|
||||
|
||||
|
||||
@@ -332,18 +332,18 @@ CPTableColumnUserResizingMask = 1 << 1;
|
||||
individual cell that is shown. As a result, changes made after calling this method won't be reflected.
|
||||
|
||||
Example:
|
||||
@code
|
||||
[tableColumn setDataView:someView]; // snapshot taken
|
||||
[[tableColumn dataView] setSomething:x]; //won't work
|
||||
@endcode
|
||||
@code
|
||||
[tableColumn setDataView:someView]; // snapshot taken
|
||||
[[tableColumn dataView] setSomething:x]; //won't work
|
||||
@endcode
|
||||
|
||||
This doesn't work because the snapshot is taken before the new property is applied. Instead, do:
|
||||
@code
|
||||
[someView setSomething:x];
|
||||
[tableColumn setDataView:someView];
|
||||
@endcode
|
||||
@code
|
||||
[someView setSomething:x];
|
||||
[tableColumn setDataView:someView];
|
||||
@endcode
|
||||
|
||||
@note you should implement CPKeyedArchiving otherwise you might see unexpected results.
|
||||
@note You should implement CPKeyedArchiving otherwise you might see unexpected results.
|
||||
This is done by adding the following methods to your class:
|
||||
@endnote
|
||||
|
||||
@@ -380,7 +380,7 @@ CPTableColumnUserResizingMask = 1 << 1;
|
||||
}
|
||||
@endcode
|
||||
|
||||
@section Themeing
|
||||
@section Theming
|
||||
|
||||
When you set a dataview and it is added to the tableview the theme state will be set to \c CPThemeStateTableDataView
|
||||
When the dataview becomes selected the theme state will be set to \c CPThemeStateSelectedDataView.
|
||||
|
||||
@@ -323,6 +323,7 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
{
|
||||
_tableViewFlags = 0;
|
||||
_lastSelectedRow = -1;
|
||||
_clickedRow = -1;
|
||||
|
||||
_selectedColumnIndexes = [CPIndexSet indexSet];
|
||||
_selectedRowIndexes = [CPIndexSet indexSet];
|
||||
|
||||
@@ -169,8 +169,8 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
|
||||
|
||||
+ (id)themeAttributes
|
||||
{
|
||||
return [CPDictionary dictionaryWithObjects:[_CGInsetMakeZero(), _CGInsetMake(2.0, 2.0, 2.0, 2.0), [CPNull null]]
|
||||
forKeys:[@"bezel-inset", @"content-inset", @"bezel-color"]];
|
||||
return [CPDictionary dictionaryWithObjects:[_CGInsetMakeZero(), _CGInsetMake(2.0, 2.0, 2.0, 2.0), _CGInsetMake(3.0, 3.0, 3.0, 3.0), [CPNull null]]
|
||||
forKeys:[@"bezel-inset", @"content-inset", @"border-inset", @"bezel-color"]];
|
||||
}
|
||||
|
||||
/* @ignore */
|
||||
@@ -507,31 +507,32 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
|
||||
}
|
||||
|
||||
var contentRect = [self contentRectForBounds:[self bounds]],
|
||||
verticalAlign = [self currentValueForThemeAttribute:"vertical-alignment"];
|
||||
verticalAlign = [self currentValueForThemeAttribute:"vertical-alignment"],
|
||||
lineHeight = [font defaultLineHeightForFont];
|
||||
|
||||
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"; // for the same reason we have a -1 for the left, we also have a + 1 here
|
||||
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.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);
|
||||
|
||||
@@ -625,15 +626,11 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
|
||||
|
||||
#endif
|
||||
|
||||
// post CPControlTextDidEndEditingNotification
|
||||
if (_isEditing)
|
||||
{
|
||||
_isEditing = NO;
|
||||
[self textDidEndEditing:[CPNotification notificationWithName:CPControlTextDidEndEditingNotification object:self userInfo:nil]];
|
||||
_isEditing = NO;
|
||||
[self textDidEndEditing:[CPNotification notificationWithName:CPControlTextDidEndEditingNotification object:self userInfo:nil]];
|
||||
|
||||
if ([self sendsActionOnEndEditing])
|
||||
[self sendAction:[self action] to:[self target]];
|
||||
}
|
||||
if ([self sendsActionOnEndEditing])
|
||||
[self sendAction:[self action] to:[self target]];
|
||||
|
||||
[self textDidBlur:[CPNotification notificationWithName:CPTextFieldDidBlurNotification object:self userInfo:nil]];
|
||||
|
||||
@@ -1024,7 +1021,7 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
|
||||
maxSize = [self currentValueForThemeAttribute:@"max-size"],
|
||||
lineBreakMode = [self lineBreakMode],
|
||||
text = (_stringValue || @" "),
|
||||
textSize = _CGSizeMakeCopy(frameSize),
|
||||
textSize = CGSizeMakeCopy(frameSize),
|
||||
font = [self currentValueForThemeAttribute:@"font"];
|
||||
|
||||
textSize.width -= contentInset.left + contentInset.right;
|
||||
@@ -1294,10 +1291,8 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
|
||||
|
||||
- (CGRect)contentRectForBounds:(CGRect)bounds
|
||||
{
|
||||
var contentInset = [self currentValueForThemeAttribute:@"content-inset"];
|
||||
|
||||
if (!contentInset)
|
||||
return bounds;
|
||||
var bezelInset = [self currentValueForThemeAttribute:@"bezel-inset"],
|
||||
contentInset = [self currentValueForThemeAttribute:@"content-inset"];
|
||||
|
||||
bounds.origin.x += contentInset.left;
|
||||
bounds.origin.y += contentInset.top;
|
||||
@@ -1322,6 +1317,14 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
|
||||
return bounds;
|
||||
}
|
||||
|
||||
- (CGInset)borderInset
|
||||
{
|
||||
var bezelInset = [self currentValueForThemeAttribute:@"bezel-inset"],
|
||||
borderInset = [self currentValueForThemeAttribute:@"border-inset"];
|
||||
|
||||
return CGInsetUnion(bezelInset, borderInset);
|
||||
}
|
||||
|
||||
- (CGRect)rectForEphemeralSubviewNamed:(CPString)aName
|
||||
{
|
||||
if (aName === "bezel-view")
|
||||
|
||||
@@ -25,9 +25,10 @@
|
||||
@import <Foundation/CPKeyedUnarchiver.j>
|
||||
|
||||
|
||||
var CPThemesByName = { },
|
||||
CPThemeDefaultTheme = nil,
|
||||
CPThemeDefaultHudTheme = nil;
|
||||
var CPThemesByName = { },
|
||||
CPThemeNamesByInheritance = [],
|
||||
CPThemeDefaultTheme = nil,
|
||||
CPThemeDefaultHudTheme = nil;
|
||||
|
||||
|
||||
/*!
|
||||
@@ -76,6 +77,52 @@ var CPThemesByName = { },
|
||||
return CPThemesByName[aName];
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns an array of names of all loaded themes, in the order they were loaded.
|
||||
*/
|
||||
+ (CPArray)allThemeNames
|
||||
{
|
||||
return [CPThemeNamesByInheritance copy];
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the closest matching theme for a given view or view class.
|
||||
The matching proceeds as follows:
|
||||
|
||||
- The default theme class name for the class is retrieved.
|
||||
- Starting with the last loaded theme and proceeding towards the default theme,
|
||||
each theme is checked to see if it defines that theme class.
|
||||
- If the theme defines the class name, that theme is returned.
|
||||
- If no themes match, the default theme is returned.
|
||||
|
||||
@param aViewOrClass The view or view class to match with a theme
|
||||
@return The first matching theme
|
||||
*/
|
||||
+ (CPTheme)themeForView:(id)aViewOrClass
|
||||
{
|
||||
var themeClass = nil;
|
||||
|
||||
if (class_isMetaClass(aViewOrClass.isa))
|
||||
themeClass = [aViewOrClass defaultThemeClass];
|
||||
else
|
||||
themeClass = [aViewOrClass themeClass];
|
||||
|
||||
if (themeClass)
|
||||
{
|
||||
var count = CPThemeNamesByInheritance.length;
|
||||
|
||||
while (count--)
|
||||
{
|
||||
var theme = CPThemesByName[CPThemeNamesByInheritance[count]];
|
||||
|
||||
if ([theme._attributes containsKey:themeClass])
|
||||
return theme;
|
||||
}
|
||||
}
|
||||
|
||||
return CPThemeDefaultTheme;
|
||||
}
|
||||
|
||||
- (id)initWithName:(CPString)aName
|
||||
{
|
||||
self = [super init];
|
||||
@@ -86,6 +133,9 @@ var CPThemesByName = { },
|
||||
_attributes = [CPDictionary dictionary];
|
||||
|
||||
CPThemesByName[_name] = self;
|
||||
|
||||
if (![CPThemeNamesByInheritance containsObject:_name])
|
||||
CPThemeNamesByInheritance.push(_name);
|
||||
}
|
||||
|
||||
return self;
|
||||
@@ -299,6 +349,9 @@ var CPThemeNameKey = @"CPThemeNameKey",
|
||||
_attributes = [aCoder decodeObjectForKey:CPThemeAttributesKey];
|
||||
|
||||
CPThemesByName[_name] = self;
|
||||
|
||||
if (![CPThemeNamesByInheritance containsObject:_name])
|
||||
CPThemeNamesByInheritance.push(_name);
|
||||
}
|
||||
|
||||
return self;
|
||||
|
||||
@@ -93,7 +93,7 @@ var CPThemeStateAutoCompleting = @"CPThemeStateAutoCompleting",
|
||||
return "tokenfield";
|
||||
}
|
||||
|
||||
- (id)initWithFrame:(CPRect)frame
|
||||
- (id)initWithFrame:(CGRect)frame
|
||||
{
|
||||
if (self = [super initWithFrame:frame])
|
||||
{
|
||||
@@ -116,12 +116,12 @@ var CPThemeStateAutoCompleting = @"CPThemeStateAutoCompleting",
|
||||
{
|
||||
var frame = [self frame];
|
||||
|
||||
_tokenScrollView = [[CPScrollView alloc] initWithFrame:CGRectMakeZero()];
|
||||
_tokenScrollView = [[CPScrollView alloc] initWithFrame:_CGRectMakeZero()];
|
||||
[_tokenScrollView setHasHorizontalScroller:NO];
|
||||
[_tokenScrollView setHasVerticalScroller:NO];
|
||||
[_tokenScrollView setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable];
|
||||
|
||||
var contentView = [[CPView alloc] initWithFrame:CGRectMakeZero()];
|
||||
var contentView = [[CPView alloc] initWithFrame:_CGRectMakeZero()];
|
||||
[contentView setAutoresizingMask:CPViewWidthSizable];
|
||||
[_tokenScrollView setDocumentView:contentView];
|
||||
|
||||
@@ -129,15 +129,15 @@ var CPThemeStateAutoCompleting = @"CPThemeStateAutoCompleting",
|
||||
|
||||
_cachedCompletions = [];
|
||||
|
||||
_autocompleteContainer = [[CPView alloc] initWithFrame:CPRectMake(0.0, 0.0, frame.size.width, 92.0)];
|
||||
_autocompleteContainer = [[CPView alloc] initWithFrame:_CGRectMake(0.0, 0.0, frame.size.width, 92.0)];
|
||||
[_autocompleteContainer setBackgroundColor:[_CPMenuWindow backgroundColorForBackgroundStyle:_CPMenuWindowPopUpBackgroundStyle]];
|
||||
|
||||
_autocompleteScrollView = [[CPScrollView alloc] initWithFrame:CPRectMake(1.0, 1.0, frame.size.width - 2.0, 90.0)];
|
||||
_autocompleteScrollView = [[CPScrollView alloc] initWithFrame:_CGRectMake(1.0, 1.0, frame.size.width - 2.0, 90.0)];
|
||||
[_autocompleteScrollView setAutohidesScrollers:YES];
|
||||
[_autocompleteScrollView setHasHorizontalScroller:NO];
|
||||
[_autocompleteContainer addSubview:_autocompleteScrollView];
|
||||
|
||||
_autocompleteView = [[CPTableView alloc] initWithFrame:CPRectMakeZero()];
|
||||
_autocompleteView = [[CPTableView alloc] initWithFrame:_CGRectMakeZero()];
|
||||
|
||||
var tableColumn = [[CPTableColumn alloc] initWithIdentifier:CPTokenFieldTableColumnIdentifier];
|
||||
[tableColumn setResizingMask:CPTableColumnAutoresizingMask];
|
||||
@@ -163,12 +163,16 @@ var CPThemeStateAutoCompleting = @"CPThemeStateAutoCompleting",
|
||||
{
|
||||
var indexOfSelectedItem = 0;
|
||||
|
||||
#if PLATFORM(DOM)
|
||||
_cachedCompletions = [self tokenField:self completionsForSubstring:[self _inputElement].value indexOfToken:0 indexOfSelectedItem:indexOfSelectedItem];
|
||||
#endif
|
||||
|
||||
[_autocompleteView selectRowIndexes:[CPIndexSet indexSetWithIndex:indexOfSelectedItem] byExtendingSelection:NO];
|
||||
[_autocompleteView reloadData];
|
||||
}
|
||||
|
||||
#if PLATFORM(DOM)
|
||||
|
||||
- (void)_autocompleteWithDOMEvent:(JSObject)DOMEvent
|
||||
{
|
||||
if (!_cachedCompletions || ![self hasThemeState:CPThemeStateAutoCompleting])
|
||||
@@ -222,6 +226,8 @@ var CPThemeStateAutoCompleting = @"CPThemeStateAutoCompleting",
|
||||
[self _autocompleteWithDOMEvent:nil];
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
- (void)_selectToken:(_CPTokenFieldToken)token byExtendingSelection:(BOOL)extend
|
||||
{
|
||||
var indexOfToken = [[self _tokens] indexOfObject:token];
|
||||
@@ -372,10 +378,10 @@ var CPThemeStateAutoCompleting = @"CPThemeStateAutoCompleting",
|
||||
|
||||
[self unsetThemeState:CPThemeStateEditing];
|
||||
|
||||
[self _autocomplete];
|
||||
|
||||
#if PLATFORM(DOM)
|
||||
|
||||
[self _autocomplete];
|
||||
|
||||
var element = [self _inputElement];
|
||||
|
||||
CPTokenFieldInputResigning = YES;
|
||||
@@ -658,7 +664,7 @@ var CPThemeStateAutoCompleting = @"CPThemeStateAutoCompleting",
|
||||
rowRect = [autocompleteView rectOfRow:index],
|
||||
owner = CPTokenFieldInputOwner;
|
||||
|
||||
if (rowRect && !CPRectContainsRect([clipView bounds], rowRect))
|
||||
if (rowRect && !CGRectContainsRect([clipView bounds], rowRect))
|
||||
[clipView scrollToPoint:[autocompleteView rectOfRow:index].origin];
|
||||
|
||||
if (aDOMEvent.keyCode === CPReturnKeyCode || aDOMEvent.keyCode === CPTabKeyCode)
|
||||
@@ -748,7 +754,7 @@ var CPThemeStateAutoCompleting = @"CPThemeStateAutoCompleting",
|
||||
else if (aDOMEvent.keyCode === CPDeleteKeyCode)
|
||||
{
|
||||
// Highlight the previous token if backspace was pressed in an empty input element or re-show the completions view
|
||||
if (CPTokenFieldDOMInputElement.value == @"")
|
||||
if (CPTokenFieldDOMInputElement.value.length === 0)
|
||||
{
|
||||
[self _hideCompletions];
|
||||
|
||||
@@ -868,6 +874,15 @@ var CPThemeStateAutoCompleting = @"CPThemeStateAutoCompleting",
|
||||
}
|
||||
#endif
|
||||
|
||||
// In the context of a token field, it is empty when there are no tokens
|
||||
- (void)_updatePlaceholderState
|
||||
{
|
||||
if (([[self _tokens] count] === 0) && ![self hasThemeState:CPThemeStateEditing])
|
||||
[self setThemeState:CPTextFieldStatePlaceholder];
|
||||
else
|
||||
[self unsetThemeState:CPTextFieldStatePlaceholder];
|
||||
}
|
||||
|
||||
// - (void)setTokenStyle: (NSTokenStyle) style;
|
||||
// - (NSTokenStyle)tokenStyle;
|
||||
//
|
||||
@@ -950,9 +965,9 @@ var CPThemeStateAutoCompleting = @"CPThemeStateAutoCompleting",
|
||||
// Manually sizeToFit because CPTableView's sizeToFit doesn't work properly
|
||||
[_autocompleteContainer setHidden:NO];
|
||||
var frameOrigin = [self convertPoint:[self bounds].origin toView:[_autocompleteContainer superview]];
|
||||
[_autocompleteContainer setFrameOrigin:CPPointMake(frameOrigin.x, frameOrigin.y + frame.size.height)];
|
||||
[_autocompleteContainer setFrameSize:CPSizeMake(CPRectGetWidth([self bounds]), 92.0)];
|
||||
[_autocompleteScrollView setFrameSize:CPSizeMake([_autocompleteContainer frame].size.width - 2.0, 90.0)];
|
||||
[_autocompleteContainer setFrameOrigin:_CGPointMake(frameOrigin.x, frameOrigin.y + frame.size.height)];
|
||||
[_autocompleteContainer setFrameSize:_CGSizeMake(_CGRectGetWidth([self bounds]), 92.0)];
|
||||
[_autocompleteScrollView setFrameSize:_CGSizeMake([_autocompleteContainer frame].size.width - 2.0, 90.0)];
|
||||
}
|
||||
else
|
||||
[_autocompleteContainer setHidden:YES];
|
||||
@@ -962,11 +977,11 @@ var CPThemeStateAutoCompleting = @"CPThemeStateAutoCompleting",
|
||||
return;
|
||||
|
||||
// Move each token into the right position.
|
||||
var contentRect = CGRectMakeCopy([contentView bounds]),
|
||||
var contentRect = _CGRectMakeCopy([contentView bounds]),
|
||||
contentOrigin = contentRect.origin,
|
||||
contentSize = contentRect.size,
|
||||
offset = CPPointMake(contentOrigin.x, contentOrigin.y),
|
||||
spaceBetweenTokens = CPSizeMake(2.0, 2.0),
|
||||
offset = _CGPointMake(contentOrigin.x, contentOrigin.y),
|
||||
spaceBetweenTokens = _CGSizeMake(2.0, 2.0),
|
||||
isEditing = [[self window] firstResponder] == self,
|
||||
tokenToken = [_CPTokenFieldToken new];
|
||||
|
||||
@@ -977,7 +992,7 @@ var CPThemeStateAutoCompleting = @"CPThemeStateAutoCompleting",
|
||||
|
||||
var fitAndFrame = function(width, height)
|
||||
{
|
||||
var r = CGRectMake(0, 0, width, height);
|
||||
var r = _CGRectMake(0, 0, width, height);
|
||||
|
||||
if (offset.x + width >= contentSize.width && offset.x > contentOrigin.x)
|
||||
{
|
||||
@@ -990,7 +1005,7 @@ var CPThemeStateAutoCompleting = @"CPThemeStateAutoCompleting",
|
||||
|
||||
// Make sure the frame fits.
|
||||
if (CGRectGetHeight([contentView bounds]) < offset.y + height)
|
||||
[contentView setFrame:CGRectMake(0, 0, CGRectGetWidth([_tokenScrollView bounds]), offset.y + height)];
|
||||
[contentView setFrame:_CGRectMake(0, 0, CGRectGetWidth([_tokenScrollView bounds]), offset.y + height)];
|
||||
|
||||
offset.x += width + spaceBetweenTokens.width;
|
||||
|
||||
@@ -999,6 +1014,7 @@ var CPThemeStateAutoCompleting = @"CPThemeStateAutoCompleting",
|
||||
|
||||
var placeEditor = function(useRemainingWidth)
|
||||
{
|
||||
#if PLATFORM(DOM)
|
||||
var element = [self _inputElement],
|
||||
textWidth = 1;
|
||||
|
||||
@@ -1008,6 +1024,7 @@ var CPThemeStateAutoCompleting = @"CPThemeStateAutoCompleting",
|
||||
// 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;
|
||||
|
||||
if (useRemainingWidth)
|
||||
textWidth = MAX(contentSize.width - offset.x - 1, textWidth);
|
||||
}
|
||||
@@ -1022,6 +1039,7 @@ var CPThemeStateAutoCompleting = @"CPThemeStateAutoCompleting",
|
||||
// When editing, always scroll to the cursor.
|
||||
if (_selectedRange.length == 0)
|
||||
[[_tokenScrollView documentView] scrollRectToVisible:inputFrame];
|
||||
#endif
|
||||
}
|
||||
|
||||
for (var i = 0, count = [tokens count]; i < count; i++)
|
||||
@@ -1048,6 +1066,7 @@ var CPThemeStateAutoCompleting = @"CPThemeStateAutoCompleting",
|
||||
if (isEditing && CPMaxRange(_selectedRange) >= [tokens count])
|
||||
placeEditor(true);
|
||||
|
||||
#if PLATFORM(DOM)
|
||||
// Hide the editor if there are selected tokens, but still keep it active
|
||||
// so we can continue using our standard keyboard handling events.
|
||||
if (isEditing && _selectedRange.length)
|
||||
@@ -1055,24 +1074,27 @@ var CPThemeStateAutoCompleting = @"CPThemeStateAutoCompleting",
|
||||
[self _inputElement].style.left = "-10000px";
|
||||
[self _inputElement].focus();
|
||||
}
|
||||
#endif
|
||||
|
||||
// Trim off any excess height downwards.
|
||||
if (CGRectGetHeight([contentView bounds]) > offset.y + tokenHeight)
|
||||
[contentView setFrame:CGRectMake(0, 0, CGRectGetWidth([_tokenScrollView bounds]), offset.y + tokenHeight)];
|
||||
[contentView setFrame:_CGRectMake(0, 0, CGRectGetWidth([_tokenScrollView bounds]), offset.y + tokenHeight)];
|
||||
|
||||
if (_shouldScrollTo !== CPScrollDestinationNone)
|
||||
{
|
||||
// Only carry out the scroll if the cursor isn't visible.
|
||||
if (!(isEditing && _selectedRange.length == 0))
|
||||
{
|
||||
|
||||
var scrollToToken = _shouldScrollTo;
|
||||
|
||||
if (scrollToToken === CPScrollDestinationLeft)
|
||||
scrollToToken = tokens[_selectedRange.location]
|
||||
else if (scrollToToken === CPScrollDestinationRight)
|
||||
scrollToToken = tokens[MAX(0, CPMaxRange(_selectedRange) - 1)];
|
||||
|
||||
[self _scrollTokenViewToVisible:scrollToToken];
|
||||
}
|
||||
|
||||
_shouldScrollTo = CPScrollDestinationNone;
|
||||
}
|
||||
}
|
||||
@@ -1188,11 +1210,11 @@ var CPThemeStateAutoCompleting = @"CPThemeStateAutoCompleting",
|
||||
return "tokenfield-token";
|
||||
}
|
||||
|
||||
- (id)initWithFrame:(CPRect)frame
|
||||
- (id)initWithFrame:(CGRect)frame
|
||||
{
|
||||
if (self = [super initWithFrame:frame])
|
||||
{
|
||||
_deleteButton = [[_CPTokenFieldTokenCloseButton alloc] initWithFrame:CPRectMakeZero()];
|
||||
_deleteButton = [[_CPTokenFieldTokenCloseButton alloc] initWithFrame:_CGRectMakeZero()];
|
||||
[self addSubview:_deleteButton];
|
||||
|
||||
[self setEditable:NO];
|
||||
@@ -1253,7 +1275,7 @@ var CPThemeStateAutoCompleting = @"CPThemeStateAutoCompleting",
|
||||
buttonOffset = [_deleteButton currentValueForThemeAttribute:@"offset"],
|
||||
buttonSize = [_deleteButton currentValueForThemeAttribute:@"min-size"];
|
||||
|
||||
[_deleteButton setFrame:CPRectMake(CPRectGetMaxX(frame) - buttonOffset.x, CPRectGetMinY(frame) + buttonOffset.y, buttonSize.width, buttonSize.height)];
|
||||
[_deleteButton setFrame:_CGRectMake(_CGRectGetMaxX(frame) - buttonOffset.x, _CGRectGetMinY(frame) + buttonOffset.y, buttonSize.width, buttonSize.height)];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1329,4 +1351,4 @@ var CPTokenFieldTokenizingCharacterSetKey = "CPTokenFieldTokenizingCharacterSe
|
||||
[aCoder encodeDouble:_completionDelay forKey:CPTokenFieldCompletionDelayKey];
|
||||
}
|
||||
|
||||
@end
|
||||
@end
|
||||
|
||||
@@ -295,7 +295,7 @@ var CPViewFlags = { },
|
||||
_DOMImageSizes = [];
|
||||
#endif
|
||||
|
||||
_theme = [CPTheme defaultTheme];
|
||||
_theme = [CPTheme themeForView:self];
|
||||
_themeState = CPThemeStateNormal;
|
||||
|
||||
[self setupViewFlags];
|
||||
@@ -2543,6 +2543,32 @@ setBoundsOrigin:
|
||||
return (_themeAttributes && _themeAttributes[aName] !== undefined);
|
||||
}
|
||||
|
||||
- (void)registerThemeValues:(CPArray)themeValues
|
||||
{
|
||||
for (var i = 0; i < themeValues.length; ++i)
|
||||
{
|
||||
var attributeValueState = themeValues[i],
|
||||
attribute = attributeValueState[0],
|
||||
value = attributeValueState[1],
|
||||
state = attributeValueState[2];
|
||||
|
||||
if (state)
|
||||
[self setValue:value forThemeAttribute:attribute inState:state];
|
||||
else
|
||||
[self setValue:value forThemeAttribute:attribute];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)registerThemeValues:(CPArray)themeValues inherit:(CPArray)inheritedValues
|
||||
{
|
||||
// Register inherited values first, then override those with the subtheme values.
|
||||
if (inheritedValues)
|
||||
[self registerThemeValues:inheritedValues];
|
||||
|
||||
if (themeValues)
|
||||
[self registerThemeValues:themeValues];
|
||||
}
|
||||
|
||||
- (CPView)createEphemeralSubviewNamed:(CPString)aViewName
|
||||
{
|
||||
return nil;
|
||||
@@ -2695,7 +2721,7 @@ var CPViewAutoresizingMaskKey = @"CPViewAutoresizingMask",
|
||||
|
||||
[self setupViewFlags];
|
||||
|
||||
_theme = [CPTheme defaultTheme];
|
||||
_theme = [CPTheme themeForView:self];
|
||||
_themeClass = [aCoder decodeObjectForKey:CPViewThemeClassKey];
|
||||
_themeState = CPThemeState([aCoder decodeIntForKey:CPViewThemeStateKey]);
|
||||
_themeAttributes = {};
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* CPCibRuntimeAttributesConnector.j
|
||||
* AppKit
|
||||
*
|
||||
* Created by Aparajita Fishman.
|
||||
* Copyright 2011, 280 North, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
@import "CPCibConnector.j"
|
||||
|
||||
var CPCibRuntimeAttributesConnectorObjectKey = @"CPCibRuntimeAttributesConnectorObjectKey",
|
||||
CPCibRuntimeAttributesConnectorKeyPathsKey = @"CPCibRuntimeAttributesConnectorKeyPathsKey",
|
||||
CPCibRuntimeAttributesConnectorValuesKey = @"CPCibRuntimeAttributesConnectorValuesKey";
|
||||
|
||||
@implementation CPCibRuntimeAttributesConnector : CPCibConnector
|
||||
{
|
||||
id _keyPaths;
|
||||
id _values;
|
||||
}
|
||||
|
||||
- (id)initWithCoder:(CPCoder)aCoder
|
||||
{
|
||||
if (self = [super initWithCoder:aCoder])
|
||||
{
|
||||
_source = [aCoder decodeObjectForKey:CPCibRuntimeAttributesConnectorObjectKey];
|
||||
_keyPaths = [aCoder decodeObjectForKey:CPCibRuntimeAttributesConnectorKeyPathsKey];
|
||||
_values = [aCoder decodeObjectForKey:CPCibRuntimeAttributesConnectorValuesKey];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)encodeWithCoder:(CPCoder)aCoder
|
||||
{
|
||||
[super encodeWithCoder:aCoder];
|
||||
|
||||
[aCoder encodeObject:_source forKey:CPCibRuntimeAttributesConnectorObjectKey];
|
||||
[aCoder encodeObject:_keyPaths forKey:CPCibRuntimeAttributesConnectorKeyPathsKey];
|
||||
[aCoder encodeObject:_values forKey:CPCibRuntimeAttributesConnectorValuesKey];
|
||||
}
|
||||
|
||||
- (void)establishConnection
|
||||
{
|
||||
var count = [_keyPaths count];
|
||||
|
||||
while (count--)
|
||||
[_source setValue:_values[count] forKeyPath:_keyPaths[count]];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -61,14 +61,14 @@ var _CPCibClassSwapperClassNameKey = @"_CPCibClassSwapperClassNameKey",
|
||||
|
||||
if (!object)
|
||||
{
|
||||
CPLog.error("Unable to find class " + theClassName + " in cib file.");
|
||||
CPLog.error("Unable to find class " + theClassName + " referenced in cib file.");
|
||||
|
||||
object = [self allocObjectWithCoder:aCoder className:[aCoder decodeObjectForKey:_CPCibClassSwapperOriginalClassNameKey]];
|
||||
}
|
||||
}
|
||||
|
||||
if (!object)
|
||||
[CPException raise:CPInvalidArgumentException reason:@"Unable to find class " + theClassName + " in cib file."];
|
||||
[CPException raise:CPInvalidArgumentException reason:@"Unable to find class " + theClassName + " referenced in cib file."];
|
||||
|
||||
return object;
|
||||
}
|
||||
|
||||
@@ -43,6 +43,11 @@ var _CPCibCustomResourceClassNameKey = @"_CPCibCustomResourceClassNameKey",
|
||||
return [[self alloc] initWithClassName:@"CPImage" resourceName:aResourceName properties:[CPDictionary dictionaryWithObject:aSize forKey:@"size"]];
|
||||
}
|
||||
|
||||
+ (id)imageResourceWithName:(CPString)aResourceName size:(CGSize)aSize bundleClass:(CPString)aBundleClass
|
||||
{
|
||||
return [[self alloc] initWithClassName:@"CPImage" resourceName:aResourceName properties:[CPDictionary dictionaryWithObjects:[aSize, aBundleClass] forKeys:[@"size", @"bundleClass"]]];
|
||||
}
|
||||
|
||||
- (id)initWithClassName:(CPString)aClassName resourceName:(CPString)aResourceName properties:(CPDictionary)properties
|
||||
{
|
||||
self = [super init];
|
||||
@@ -89,7 +94,18 @@ var _CPCibCustomResourceClassNameKey = @"_CPCibCustomResourceClassNameKey",
|
||||
else if (_resourceName == "CPRemoveTemplate")
|
||||
return [[CPImage alloc] initWithContentsOfFile:[[CPBundle bundleForClass:[CPButtonBar class]] pathForResource:@"minus_button.png"] size:CGSizeMake(11, 4)];
|
||||
|
||||
return [[CPImage alloc] initWithContentsOfFile:[[aCoder bundle] pathForResource:_resourceName] size:_properties.valueForKey(@"size")];
|
||||
var bundleClass = _properties.valueForKey(@"bundleClass"),
|
||||
bundle = nil;
|
||||
|
||||
if (bundleClass)
|
||||
{
|
||||
bundleClass = CPClassFromString(bundleClass);
|
||||
|
||||
if (bundleClass)
|
||||
bundle = [CPBundle bundleForClass:bundleClass];
|
||||
}
|
||||
|
||||
return [[CPImage alloc] initWithContentsOfFile:[(bundle || [aCoder bundle]) pathForResource:_resourceName] size:_properties.valueForKey(@"size")];
|
||||
}
|
||||
|
||||
return self;
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
@import "CPCibControlConnector.j"
|
||||
@import "CPCibOutletConnector.j"
|
||||
@import "CPCibBindingConnector.j"
|
||||
@import "CPCibRuntimeAttributesConnector.j"
|
||||
|
||||
|
||||
@implementation _CPCibObjectData : CPObject
|
||||
@@ -257,11 +258,29 @@ var _CPCibObjectDataNamesKeysKey = @"_CPCibObjectDataNamesKeysKey
|
||||
_replacementObjects[[_fileOwner UID]] = anOwner;
|
||||
|
||||
var index = 0,
|
||||
count = _connections.length;
|
||||
count = _connections.length,
|
||||
runtimeAttributeConnectors = [],
|
||||
connection = nil;
|
||||
|
||||
for (; index < count; ++index)
|
||||
{
|
||||
var connection = _connections[index];
|
||||
connection = _connections[index];
|
||||
|
||||
if ([connection isKindOfClass:[CPCibRuntimeAttributesConnector class]])
|
||||
// Defer runtime attribute connections until after all other connections are made
|
||||
runtimeAttributeConnectors.push(connection);
|
||||
else
|
||||
{
|
||||
[connection replaceObjects:_replacementObjects];
|
||||
[connection establishConnection];
|
||||
}
|
||||
}
|
||||
|
||||
count = runtimeAttributeConnectors.length;
|
||||
|
||||
for (index = 0; index < count; ++index)
|
||||
{
|
||||
connection = runtimeAttributeConnectors[index];
|
||||
|
||||
[connection replaceObjects:_replacementObjects];
|
||||
[connection establishConnection];
|
||||
|
||||
@@ -267,6 +267,32 @@ function CGPointFromEvent(anEvent)
|
||||
return _CGPointMake(anEvent.clientX, anEvent.clientY);
|
||||
}
|
||||
|
||||
/*!
|
||||
Combines two insets by adding their individual elements and returns the result.
|
||||
|
||||
@group CGInset
|
||||
*/
|
||||
function CGInsetUnion(lhsInset, rhsInset)
|
||||
{
|
||||
return _CGInsetMake(lhsInset.top + rhsInset.top,
|
||||
lhsInset.right + rhsInset.right,
|
||||
lhsInset.bottom + rhsInset.bottom,
|
||||
lhsInset.left + rhsInset.left);
|
||||
}
|
||||
|
||||
/*!
|
||||
Subtract one inset from another by subtracting their individual elements and returns the result.
|
||||
|
||||
@group CGInset
|
||||
*/
|
||||
function CGInsetDifference(lhsInset, rhsInset)
|
||||
{
|
||||
return _CGInsetMake(lhsInset.top - rhsInset.top,
|
||||
lhsInset.right - rhsInset.right,
|
||||
lhsInset.bottom - rhsInset.bottom,
|
||||
lhsInset.left - rhsInset.left);
|
||||
}
|
||||
|
||||
function CGInsetFromString(aString)
|
||||
{
|
||||
var numbers = aString.substr(1, aString.length - 2).split(',');
|
||||
|
||||
|
After Width: | Height: | Size: 146 B |
|
After Width: | Height: | Size: 141 B |
|
After Width: | Height: | Size: 219 B |
|
After Width: | Height: | Size: 490 B |
|
After Width: | Height: | Size: 160 B |
|
After Width: | Height: | Size: 361 B |
|
After Width: | Height: | Size: 694 B |
|
After Width: | Height: | Size: 221 B |
|
After Width: | Height: | Size: 146 B |
|
After Width: | Height: | Size: 141 B |
|
After Width: | Height: | Size: 219 B |
|
After Width: | Height: | Size: 407 B |
|
After Width: | Height: | Size: 160 B |
|
After Width: | Height: | Size: 348 B |
|
After Width: | Height: | Size: 622 B |
|
After Width: | Height: | Size: 217 B |
|
After Width: | Height: | Size: 422 B |
|
After Width: | Height: | Size: 527 B |
|
Before Width: | Height: | Size: 123 B After Width: | Height: | Size: 142 B |
|
After Width: | Height: | Size: 142 B |
|
After Width: | Height: | Size: 447 B |
|
After Width: | Height: | Size: 471 B |
|
Before Width: | Height: | Size: 149 B After Width: | Height: | Size: 164 B |
|
Before Width: | Height: | Size: 757 B After Width: | Height: | Size: 844 B |
|
Before Width: | Height: | Size: 735 B After Width: | Height: | Size: 908 B |
|
Before Width: | Height: | Size: 559 B After Width: | Height: | Size: 472 B |
|
Before Width: | Height: | Size: 531 B After Width: | Height: | Size: 515 B |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 155 B |
|
Before Width: | Height: | Size: 1004 B After Width: | Height: | Size: 130 B |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 160 B |
|
Before Width: | Height: | Size: 994 B After Width: | Height: | Size: 117 B |
|
Before Width: | Height: | Size: 991 B After Width: | Height: | Size: 109 B |
|
Before Width: | Height: | Size: 994 B After Width: | Height: | Size: 115 B |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 158 B |
|
Before Width: | Height: | Size: 997 B After Width: | Height: | Size: 124 B |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 159 B |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 160 B |
|
Before Width: | Height: | Size: 1004 B After Width: | Height: | Size: 129 B |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 164 B |
|
Before Width: | Height: | Size: 994 B After Width: | Height: | Size: 117 B |
|
Before Width: | Height: | Size: 991 B After Width: | Height: | Size: 109 B |
|
Before Width: | Height: | Size: 994 B After Width: | Height: | Size: 115 B |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 158 B |
|
Before Width: | Height: | Size: 997 B After Width: | Height: | Size: 124 B |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 159 B |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 214 B |
|
Before Width: | Height: | Size: 1012 B After Width: | Height: | Size: 133 B |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 234 B |
|
Before Width: | Height: | Size: 1012 B After Width: | Height: | Size: 130 B |
|
Before Width: | Height: | Size: 991 B After Width: | Height: | Size: 109 B |
|
Before Width: | Height: | Size: 1009 B After Width: | Height: | Size: 129 B |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 225 B |
|
Before Width: | Height: | Size: 1007 B After Width: | Height: | Size: 134 B |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 212 B |
@@ -762,46 +762,47 @@ 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]
|
||||
]),
|
||||
|
||||
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];
|
||||
|
||||
// Global for reuse by CPTokenField.
|
||||
// Global for reuse by subclasses
|
||||
themedTextFieldValues =
|
||||
[
|
||||
[@"vertical-alignment", CPTopVerticalTextAlignment, CPThemeStateBezeled],
|
||||
@@ -810,30 +811,37 @@ 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", CGInsetMake(0.0, 0.0, 0.0, 0.0)],
|
||||
[@"content-inset", CGInsetMake(2.0, 2.0, 2.0, 2.0)], // as defined in [CPTextField +themeAttributes]
|
||||
|
||||
// with border
|
||||
[@"bezel-inset", CGInsetMake(0.0, 0.0, 0.0, 0.0), CPThemeStateBezeled],
|
||||
[@"bezel-inset", CGInsetMake(0.0, 0.0, 0.0, 0.0), CPThemeStateBezeled | CPThemeStateEditing],
|
||||
[@"border-inset", CGInsetMake(3.0, 3.0, 3.0, 3.0), CPThemeStateBezeled],
|
||||
[@"content-inset", CGInsetMake(8.0, 8.0, 7.0, 8.0), CPThemeStateBezeled],
|
||||
[@"content-inset", CGInsetMake(8.0, 8.0, 7.0, 8.0), CPThemeStateBezeled | CPThemeStateEditing],
|
||||
|
||||
[@"text-color", textDisabledColor, CPThemeStateBezeled | CPThemeStateDisabled],
|
||||
[@"text-color", placeholderColor, CPTextFieldStatePlaceholder],
|
||||
|
||||
[@"line-break-mode", CPLineBreakByTruncatingTail, CPThemeStateTableDataView],
|
||||
[@"vertical-alignment", CPCenterVerticalTextAlignment, CPThemeStateTableDataView],
|
||||
[@"content-inset", CGInsetMake(0.0, 0.0, 0.0, 5.0), CPThemeStateTableDataView],
|
||||
[@"content-inset", CGInsetMake(0.0, 0.0, 0.0, 4.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, 4.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]
|
||||
];
|
||||
|
||||
@@ -853,35 +861,45 @@ 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),
|
||||
|
||||
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),
|
||||
|
||||
placeholderColor = [CPColor colorWithCalibratedRed:189.0 / 255.0 green:199.0 / 255.0 blue:211.0 / 255.0 alpha:1.0];
|
||||
|
||||
// Global for reuse by CPSearchField
|
||||
// Global for reuse by subclasses
|
||||
themedRoundedTextFieldValues =
|
||||
[
|
||||
[@"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],
|
||||
[@"bezel-inset", CGInsetMake(0.0, 0.0, 0.0, 0.0), CPTextFieldStateRounded | CPThemeStateBezeled | CPThemeStateEditing],
|
||||
|
||||
// There is one extra empty pixel at the bottom for size compatibility with an earlier version.
|
||||
[@"content-inset", CGInsetMake(8.0, 15.0, 8.0, 15.0), CPTextFieldStateRounded | CPThemeStateBezeled],
|
||||
[@"content-inset", CGInsetMake(8.0, 15.0, 8.0, 15.0), CPTextFieldStateRounded | CPThemeStateBezeled | CPThemeStateEditing],
|
||||
|
||||
[@"text-color", placeholderColor, CPTextFieldStateRounded | CPTextFieldStatePlaceholder],
|
||||
|
||||
[@"min-size", CGSizeMake(0.0, 30.0), CPTextFieldStateRounded | CPThemeStateBezeled],
|
||||
@@ -914,11 +932,17 @@ 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],
|
||||
// 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, 5.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];
|
||||
@@ -958,13 +982,13 @@ var themedButtonValues = nil,
|
||||
[@"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],
|
||||
[@"content-inset", CGInsetMake(1.0, 23.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];
|
||||
@@ -990,7 +1014,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];
|
||||
@@ -998,6 +1022,86 @@ 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],
|
||||
|
||||
// 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!"],
|
||||
|
||||
@@ -288,6 +288,30 @@ var _CPimageAndTextViewFrameSizeChangedFlag = 1 << 0,
|
||||
return _textShadowOffset;
|
||||
}
|
||||
|
||||
- (CGRect)textFrame
|
||||
{
|
||||
[self layoutIfNeeded];
|
||||
|
||||
var textFrame = CGRectMakeZero();
|
||||
|
||||
#if PLATFORM(DOM)
|
||||
if (_DOMTextElement)
|
||||
{
|
||||
var textStyle = _DOMTextElement.style;
|
||||
|
||||
textFrame.origin.y = parseInt(textStyle.top.substr(0, textStyle.top.length - 2), 10),
|
||||
textFrame.origin.x = parseInt(textStyle.left.substr(0, textStyle.left.length - 2), 10),
|
||||
textFrame.size.width = parseInt(textStyle.width.substr(0, textStyle.width.length - 2), 10),
|
||||
textFrame.size.height = parseInt(textStyle.height.substr(0, textStyle.height.length - 2), 10);
|
||||
|
||||
textFrame.size.width += _textShadowOffset.width;
|
||||
textFrame.size.height += _textShadowOffset.height;
|
||||
}
|
||||
#endif
|
||||
|
||||
return textFrame;
|
||||
}
|
||||
|
||||
- (void)setImage:(CPImage)anImage
|
||||
{
|
||||
if (_image == anImage)
|
||||
|
||||
@@ -0,0 +1,838 @@
|
||||
/*
|
||||
* _CPPopUpList.j
|
||||
* AppKit
|
||||
*
|
||||
* 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 "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 when the selection of the list changes. \c object is the _CPPopUpList.
|
||||
*/
|
||||
_CPPopUpListDidDismissNotification = @"_CPPopUpListDidDismissNotification";
|
||||
|
||||
/*!
|
||||
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
|
||||
|
||||
- (void)mouseDown:(CPEvent)anEvent
|
||||
{
|
||||
if (![self isEnabled])
|
||||
return;
|
||||
|
||||
[[self delegate] setItemWasClicked:YES];
|
||||
[super mouseDown:anEvent];
|
||||
}
|
||||
|
||||
/*
|
||||
We always want the autocomplete to have focus
|
||||
*/
|
||||
- (BOOL)acceptsFirstResponder
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
/*!
|
||||
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
|
||||
@@ -0,0 +1,98 @@
|
||||
/*
|
||||
* _CPPopUpListDataSource.j
|
||||
* AppKit
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
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
|
||||
@@ -0,0 +1,54 @@
|
||||
require File.join(File.dirname(__FILE__), "repositories.rb")
|
||||
require File.join(File.dirname(__FILE__), "dependencies.rb")
|
||||
|
||||
# Keep this structure to allow the build system to update version numbers.
|
||||
VERSION_NUMBER = "1.0.0.018"
|
||||
|
||||
|
||||
# Shorten expressions
|
||||
def jars(*args)
|
||||
args.collect {|arg| project(arg).package(:jar)}
|
||||
end
|
||||
|
||||
desc "Cappuccino Distribution"
|
||||
define "cappuccino" do
|
||||
project.version = VERSION_NUMBER
|
||||
project.group = "com.intalio.cloud.cappuccino"
|
||||
|
||||
file(_("target/patch")).enhance do
|
||||
mkdir_p "target/patch"
|
||||
end
|
||||
|
||||
file(_("target/Frameworks")).enhance do
|
||||
mkdir_p "target/Frameworks/Debug"
|
||||
system <<-BASH
|
||||
export BUILD_PATH="target/Build"
|
||||
jake debug release
|
||||
BASH
|
||||
|
||||
cp_r "target/Build/Release/AppKit", "target/Frameworks/"
|
||||
cp_r "target/Build/Release/Foundation", "target/Frameworks/"
|
||||
cp_r "target/Build/Release/Objective-J", "target/Frameworks/"
|
||||
cp_r "target/Build/Debug/AppKit", "target/Frameworks/Debug/"
|
||||
cp_r "target/Build/Debug/Foundation", "target/Frameworks/Debug/"
|
||||
cp_r "target/Build/Debug/Objective-J", "target/Frameworks/Debug/"
|
||||
end
|
||||
|
||||
# file(_("target/Build")).enhance do
|
||||
# end
|
||||
read_m = ::Buildr::Packaging::Java::Manifest.parse(File.read(_("META-INF/MANIFEST.MF"))).main
|
||||
read_m["Copyright"]="Intalio, Inc 2011"
|
||||
read_m["Bundle-Version"]=VERSION_NUMBER.gsub(/SNAPSHOT/, "#{Time.now.to_i}")
|
||||
read_m.delete("Jetty-WarFragmentFolderPath")
|
||||
read_m.delete("Jetty-WarPatchFragmentFolderPath")
|
||||
package(:jar).with :manifest => read_m
|
||||
#package(:jar).include _("target/patch"), :as => "patch"
|
||||
package(:jar).include _("target/Frameworks"), :as => "META-INF/resources/Frameworks"
|
||||
|
||||
#do not include those: they are at best not read harmful.
|
||||
#package(:bundle).include _("build.properties"), :as => "build.properties"
|
||||
#package(:bundle).meta_inf << file('META-INF/web-fragment.xml')
|
||||
|
||||
end
|
||||
|
||||
|
||||
@@ -428,7 +428,9 @@ var avgOperator,
|
||||
maxOperator,
|
||||
minOperator,
|
||||
countOperator,
|
||||
sumOperator;
|
||||
sumOperator,
|
||||
distinctUnionOfObjectsOperator,
|
||||
unionOfObjectsOperator;
|
||||
|
||||
kvoOperators["avg"] = function avgOperator(self, _cmd, param)
|
||||
{
|
||||
@@ -495,6 +497,18 @@ kvoOperators["sum"] = function sumOperator(self, _cmd, param)
|
||||
return sum;
|
||||
}
|
||||
|
||||
kvoOperators["distinctUnionOfObjects"] = function distinctUnionOfObjectsOperator(self, _cmd, param)
|
||||
{
|
||||
var objects = [self valueForKeyPath:param];
|
||||
|
||||
return [[CPSet setWithArray:objects] allObjects];
|
||||
}
|
||||
|
||||
kvoOperators["unionOfObjects"] = function unionOfObjectsOperator(self, _cmd, param)
|
||||
{
|
||||
return [self valueForKeyPath:param];
|
||||
}
|
||||
|
||||
@implementation CPArray (KeyValueObserving)
|
||||
|
||||
- (void)addObserver:(id)anObserver toObjectsAtIndexes:(CPIndexSet)indexes forKeyPath:(CPString)aKeyPath options:(unsigned)options context:(id)context
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
source "http://rubygems.org"
|
||||
|
||||
gem "atoulme-Antwrap", "0.7.1" # -java
|
||||
gem "bouncy-castle-java", "1.5.0146.1"
|
||||
gem "builder", "2.1.2"
|
||||
gem "buildr", "1.4.5" # -java
|
||||
gem "buildr4osgi", "0.9.6"
|
||||
gem "bundler", "1.0.0.rc.5"
|
||||
gem "diff-lcs", "1.1.2"
|
||||
gem "highline", "1.5.1"
|
||||
gem "hoe", "2.3.3"
|
||||
gem "jruby-openssl", "0.7.4"
|
||||
gem "json_pure", "1.4.3"
|
||||
gem "manifest", "0.0.8"
|
||||
gem "minitar", "0.5.3"
|
||||
gem "net-sftp", "2.0.4"
|
||||
gem "net-ssh", "2.0.23" # 2.1.4
|
||||
gem "rake", "0.8.7" # 0.9.1
|
||||
gem "rspec", "2.1.0"
|
||||
gem "rspec-core", "2.1.0"
|
||||
gem "rspec-expectations", "2.1.0"
|
||||
gem "rspec-mocks", "2.1.0"
|
||||
gem "rubyforge", "2.0.3"
|
||||
gem "rubyzip", "0.9.4"
|
||||
gem "xml-simple", "1.0.12"
|
||||
@@ -0,0 +1,81 @@
|
||||
GEM
|
||||
remote: http://rubygems.org/
|
||||
specs:
|
||||
atoulme-Antwrap (0.7.1-java)
|
||||
bouncy-castle-java (1.5.0146.1)
|
||||
builder (2.1.2)
|
||||
buildr (1.4.5-java)
|
||||
atoulme-Antwrap (= 0.7.1)
|
||||
builder (= 2.1.2)
|
||||
diff-lcs (= 1.1.2)
|
||||
highline (= 1.5.1)
|
||||
hoe (= 2.3.3)
|
||||
jruby-openssl (>= 0.7)
|
||||
json_pure (= 1.4.3)
|
||||
minitar (= 0.5.3)
|
||||
net-sftp (= 2.0.4)
|
||||
net-ssh (= 2.0.23)
|
||||
rake (= 0.8.7)
|
||||
rspec (= 2.1.0)
|
||||
rspec-core (= 2.1.0)
|
||||
rspec-expectations (= 2.1.0)
|
||||
rspec-mocks (= 2.1.0)
|
||||
rubyforge (= 2.0.3)
|
||||
rubyzip (= 0.9.4)
|
||||
xml-simple (= 1.0.12)
|
||||
buildr4osgi (0.9.6)
|
||||
manifest (= 0.0.8)
|
||||
diff-lcs (1.1.2)
|
||||
highline (1.5.1)
|
||||
hoe (2.3.3)
|
||||
rake (>= 0.8.7)
|
||||
rubyforge (>= 1.0.4)
|
||||
jruby-openssl (0.7.4)
|
||||
bouncy-castle-java
|
||||
json_pure (1.4.3)
|
||||
manifest (0.0.8)
|
||||
minitar (0.5.3)
|
||||
net-sftp (2.0.4)
|
||||
net-ssh (>= 2.0.9)
|
||||
net-ssh (2.0.23)
|
||||
rake (0.8.7)
|
||||
rspec (2.1.0)
|
||||
rspec-core (~> 2.1.0)
|
||||
rspec-expectations (~> 2.1.0)
|
||||
rspec-mocks (~> 2.1.0)
|
||||
rspec-core (2.1.0)
|
||||
rspec-expectations (2.1.0)
|
||||
diff-lcs (~> 1.1.2)
|
||||
rspec-mocks (2.1.0)
|
||||
rubyforge (2.0.3)
|
||||
json_pure (>= 1.1.7)
|
||||
rubyzip (0.9.4)
|
||||
xml-simple (1.0.12)
|
||||
|
||||
PLATFORMS
|
||||
java
|
||||
|
||||
DEPENDENCIES
|
||||
atoulme-Antwrap (= 0.7.1)
|
||||
bouncy-castle-java (= 1.5.0146.1)
|
||||
builder (= 2.1.2)
|
||||
buildr (= 1.4.5)
|
||||
buildr4osgi (= 0.9.6)
|
||||
bundler (= 1.0.0.rc.5)
|
||||
diff-lcs (= 1.1.2)
|
||||
highline (= 1.5.1)
|
||||
hoe (= 2.3.3)
|
||||
jruby-openssl (= 0.7.4)
|
||||
json_pure (= 1.4.3)
|
||||
manifest (= 0.0.8)
|
||||
minitar (= 0.5.3)
|
||||
net-sftp (= 2.0.4)
|
||||
net-ssh (= 2.0.23)
|
||||
rake (= 0.8.7)
|
||||
rspec (= 2.1.0)
|
||||
rspec-core (= 2.1.0)
|
||||
rspec-expectations (= 2.1.0)
|
||||
rspec-mocks (= 2.1.0)
|
||||
rubyforge (= 2.0.3)
|
||||
rubyzip (= 0.9.4)
|
||||
xml-simple (= 1.0.12)
|
||||
@@ -0,0 +1,9 @@
|
||||
Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: cappuccinofrag
|
||||
Bundle-SymbolicName: com.intalio.cloud.cappuccino
|
||||
Fragment-Host: com.intalio.cloud.carbon
|
||||
Jetty-WarPatchFragmentFolderPath: /
|
||||
Bundle-Version: 1.0.0.qualifier
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||
Eclipse-BundleShape: dir
|
||||
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
* AppController.j
|
||||
* test
|
||||
*
|
||||
* Created by aparajita on May 19, 2011.
|
||||
* Copyright 2011, Victory-Heart Productions All rights reserved.
|
||||
*/
|
||||
|
||||
@import <Foundation/CPObject.j>
|
||||
|
||||
function formatter(aString, aLevel, aTitle)
|
||||
{
|
||||
return aString;
|
||||
}
|
||||
|
||||
@implementation AppController : CPObject
|
||||
{
|
||||
CPWindow theWindow; //this "outlet" is connected automatically by the Cib
|
||||
CPView simpleColor;
|
||||
CPView patternColor;
|
||||
CPView threePartColor;
|
||||
CPView ninePartColor;
|
||||
CPImage imageView;
|
||||
}
|
||||
|
||||
- (void)applicationDidFinishLaunching:(CPNotification)aNotification
|
||||
{
|
||||
// This is called when the application is done loading.
|
||||
}
|
||||
|
||||
- (void)awakeFromCib
|
||||
{
|
||||
CPLogRegister(CPLogConsole, null, formatter);
|
||||
|
||||
// In this case, we want the window from Cib to become our full browser window
|
||||
[theWindow setFullPlatformWindow:YES];
|
||||
|
||||
var color = [CPColor colorWithHexString:@"88B3FF"];
|
||||
CPLog([color description]);
|
||||
|
||||
[simpleColor setBackgroundColor:color];
|
||||
|
||||
color = CPColorWithImages("wheel_button.png", 32, 32, [CPBundle bundleForClass:[CPView class]]);
|
||||
CPLog([color description]);
|
||||
|
||||
[patternColor setBackgroundColor:color];
|
||||
|
||||
var bundle = [CPBundle bundleForClass:[CPView class]];
|
||||
|
||||
color = CPColorWithImages([
|
||||
["Aristo.blend/Resources/button-bezel-left.png", 4, 24, bundle],
|
||||
["Aristo.blend/Resources/button-bezel-center.png", 1, 24, bundle],
|
||||
["Aristo.blend/Resources/button-bezel-right.png", 4, 24, bundle]
|
||||
]);
|
||||
CPLog([color description]);
|
||||
|
||||
[threePartColor setBackgroundColor:color];
|
||||
|
||||
color = CPColorWithImages([
|
||||
["Aristo.blend/Resources/textfield-bezel-square-focused-0.png", 7, 7, bundle],
|
||||
["Aristo.blend/Resources/textfield-bezel-square-focused-1.png", 1, 7, bundle],
|
||||
["Aristo.blend/Resources/textfield-bezel-square-focused-2.png", 7, 7, bundle],
|
||||
["Aristo.blend/Resources/textfield-bezel-square-focused-3.png", 7, 1, bundle],
|
||||
["Aristo.blend/Resources/textfield-bezel-square-focused-4.png", 1, 1, bundle],
|
||||
["Aristo.blend/Resources/textfield-bezel-square-focused-5.png", 7, 1, bundle],
|
||||
["Aristo.blend/Resources/textfield-bezel-square-focused-6.png", 7, 7, bundle],
|
||||
["Aristo.blend/Resources/textfield-bezel-square-focused-7.png", 1, 7, bundle],
|
||||
["Aristo.blend/Resources/textfield-bezel-square-focused-8.png", 7, 7, bundle],
|
||||
]);
|
||||
CPLog([color description]);
|
||||
|
||||
[ninePartColor setBackgroundColor:color];
|
||||
|
||||
var image = CPImageInBundle("add1-32.png", CGSizeMake(32, 32));
|
||||
|
||||
CPLog([image description]);
|
||||
[imageView setImage:image];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -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>CPColor-CPImage-description</string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,94 @@
|
||||
/*
|
||||
* Jakefile
|
||||
* test
|
||||
*
|
||||
* Created by aparajita on May 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("----------------------------");
|
||||
}
|
||||
@@ -0,0 +1,654 @@
|
||||
<?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">10J869</string>
|
||||
<string key="IBDocument.InterfaceBuilderVersion">804</string>
|
||||
<string key="IBDocument.AppKitVersion">1038.35</string>
|
||||
<string key="IBDocument.HIToolboxVersion">461.00</string>
|
||||
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
|
||||
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string key="NS.object.0">804</string>
|
||||
</object>
|
||||
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<integer value="372"/>
|
||||
</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="NSWindowTemplate" id="972006081">
|
||||
<int key="NSWindowStyleMask">7</int>
|
||||
<int key="NSWindowBacking">2</int>
|
||||
<string key="NSWindowRect">{{335, 370}, {389, 380}}</string>
|
||||
<int key="NSWTFlags">1946157056</int>
|
||||
<string key="NSWindowTitle">Window</string>
|
||||
<string key="NSWindowClass">NSWindow</string>
|
||||
<nil key="NSViewClass"/>
|
||||
<string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string>
|
||||
<object class="NSView" key="NSWindowView" id="439893737">
|
||||
<reference key="NSNextResponder"/>
|
||||
<int key="NSvFlags">256</int>
|
||||
<object class="NSMutableArray" key="NSSubviews">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="NSCustomView" id="1066696903">
|
||||
<reference key="NSNextResponder" ref="439893737"/>
|
||||
<int key="NSvFlags">268</int>
|
||||
<string key="NSFrame">{{151, 297}, {159, 36}}</string>
|
||||
<reference key="NSSuperview" ref="439893737"/>
|
||||
<string key="NSClassName">NSView</string>
|
||||
</object>
|
||||
<object class="NSTextField" id="385245898">
|
||||
<reference key="NSNextResponder" ref="439893737"/>
|
||||
<int key="NSvFlags">268</int>
|
||||
<string key="NSFrame">{{47, 307}, {82, 17}}</string>
|
||||
<reference key="NSSuperview" ref="439893737"/>
|
||||
<bool key="NSEnabled">YES</bool>
|
||||
<object class="NSTextFieldCell" key="NSCell" id="12386750">
|
||||
<int key="NSCellFlags">68288064</int>
|
||||
<int key="NSCellFlags2">272630784</int>
|
||||
<string key="NSContents">Simple color</string>
|
||||
<object class="NSFont" key="NSSupport" id="710279137">
|
||||
<string key="NSName">LucidaGrande</string>
|
||||
<double key="NSSize">13</double>
|
||||
<int key="NSfFlags">1044</int>
|
||||
</object>
|
||||
<reference key="NSControlView" ref="385245898"/>
|
||||
<object class="NSColor" key="NSBackgroundColor" id="616930867">
|
||||
<int key="NSColorSpace">6</int>
|
||||
<string key="NSCatalogName">System</string>
|
||||
<string key="NSColorName">controlColor</string>
|
||||
<object class="NSColor" key="NSColor">
|
||||
<int key="NSColorSpace">3</int>
|
||||
<bytes key="NSWhite">MC42NjY2NjY2NjY3AA</bytes>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSColor" key="NSTextColor" id="968014435">
|
||||
<int key="NSColorSpace">6</int>
|
||||
<string key="NSCatalogName">System</string>
|
||||
<string key="NSColorName">controlTextColor</string>
|
||||
<object class="NSColor" key="NSColor">
|
||||
<int key="NSColorSpace">3</int>
|
||||
<bytes key="NSWhite">MAA</bytes>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSCustomView" id="605260233">
|
||||
<reference key="NSNextResponder" ref="439893737"/>
|
||||
<int key="NSvFlags">268</int>
|
||||
<string key="NSFrame">{{151, 243}, {159, 36}}</string>
|
||||
<reference key="NSSuperview" ref="439893737"/>
|
||||
<string key="NSClassName">NSView</string>
|
||||
</object>
|
||||
<object class="NSTextField" id="179895693">
|
||||
<reference key="NSNextResponder" ref="439893737"/>
|
||||
<int key="NSvFlags">268</int>
|
||||
<string key="NSFrame">{{47, 253}, {85, 17}}</string>
|
||||
<reference key="NSSuperview" ref="439893737"/>
|
||||
<bool key="NSEnabled">YES</bool>
|
||||
<object class="NSTextFieldCell" key="NSCell" id="222300836">
|
||||
<int key="NSCellFlags">68288064</int>
|
||||
<int key="NSCellFlags2">272630784</int>
|
||||
<string key="NSContents">Pattern color</string>
|
||||
<reference key="NSSupport" ref="710279137"/>
|
||||
<reference key="NSControlView" ref="179895693"/>
|
||||
<reference key="NSBackgroundColor" ref="616930867"/>
|
||||
<reference key="NSTextColor" ref="968014435"/>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSCustomView" id="688674788">
|
||||
<reference key="NSNextResponder" ref="439893737"/>
|
||||
<int key="NSvFlags">268</int>
|
||||
<string key="NSFrame">{{151, 186}, {159, 36}}</string>
|
||||
<reference key="NSSuperview" ref="439893737"/>
|
||||
<string key="NSClassName">NSView</string>
|
||||
</object>
|
||||
<object class="NSTextField" id="63869060">
|
||||
<reference key="NSNextResponder" ref="439893737"/>
|
||||
<int key="NSvFlags">268</int>
|
||||
<string key="NSFrame">{{47, 196}, {85, 17}}</string>
|
||||
<reference key="NSSuperview" ref="439893737"/>
|
||||
<bool key="NSEnabled">YES</bool>
|
||||
<object class="NSTextFieldCell" key="NSCell" id="828490958">
|
||||
<int key="NSCellFlags">68288064</int>
|
||||
<int key="NSCellFlags2">272630784</int>
|
||||
<string key="NSContents">3-part color</string>
|
||||
<reference key="NSSupport" ref="710279137"/>
|
||||
<reference key="NSControlView" ref="63869060"/>
|
||||
<reference key="NSBackgroundColor" ref="616930867"/>
|
||||
<reference key="NSTextColor" ref="968014435"/>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSCustomView" id="100716157">
|
||||
<reference key="NSNextResponder" ref="439893737"/>
|
||||
<int key="NSvFlags">268</int>
|
||||
<string key="NSFrame">{{151, 130}, {159, 36}}</string>
|
||||
<reference key="NSSuperview" ref="439893737"/>
|
||||
<string key="NSClassName">NSView</string>
|
||||
</object>
|
||||
<object class="NSTextField" id="488609560">
|
||||
<reference key="NSNextResponder" ref="439893737"/>
|
||||
<int key="NSvFlags">268</int>
|
||||
<string key="NSFrame">{{47, 140}, {85, 17}}</string>
|
||||
<reference key="NSSuperview" ref="439893737"/>
|
||||
<bool key="NSEnabled">YES</bool>
|
||||
<object class="NSTextFieldCell" key="NSCell" id="548167261">
|
||||
<int key="NSCellFlags">68288064</int>
|
||||
<int key="NSCellFlags2">272630784</int>
|
||||
<string key="NSContents">9-part color</string>
|
||||
<reference key="NSSupport" ref="710279137"/>
|
||||
<reference key="NSControlView" ref="488609560"/>
|
||||
<reference key="NSBackgroundColor" ref="616930867"/>
|
||||
<reference key="NSTextColor" ref="968014435"/>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSTextField" id="696346150">
|
||||
<reference key="NSNextResponder" ref="439893737"/>
|
||||
<int key="NSvFlags">268</int>
|
||||
<string key="NSFrame">{{47, 84}, {85, 17}}</string>
|
||||
<reference key="NSSuperview" ref="439893737"/>
|
||||
<bool key="NSEnabled">YES</bool>
|
||||
<object class="NSTextFieldCell" key="NSCell" id="30856995">
|
||||
<int key="NSCellFlags">68288064</int>
|
||||
<int key="NSCellFlags2">272630784</int>
|
||||
<string key="NSContents">Image</string>
|
||||
<reference key="NSSupport" ref="710279137"/>
|
||||
<reference key="NSControlView" ref="696346150"/>
|
||||
<reference key="NSBackgroundColor" ref="616930867"/>
|
||||
<reference key="NSTextColor" ref="968014435"/>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSImageView" id="276994718">
|
||||
<reference key="NSNextResponder" ref="439893737"/>
|
||||
<int key="NSvFlags">268</int>
|
||||
<object class="NSMutableSet" key="NSDragTypes">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="NSArray" key="set.sortedObjects">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>Apple PDF pasteboard type</string>
|
||||
<string>Apple PICT pasteboard type</string>
|
||||
<string>Apple PNG pasteboard type</string>
|
||||
<string>NSFilenamesPboardType</string>
|
||||
<string>NeXT Encapsulated PostScript v1.2 pasteboard type</string>
|
||||
<string>NeXT TIFF v4.0 pasteboard type</string>
|
||||
</object>
|
||||
</object>
|
||||
<string key="NSFrame">{{148, 68}, {48, 48}}</string>
|
||||
<reference key="NSSuperview" ref="439893737"/>
|
||||
<bool key="NSEnabled">YES</bool>
|
||||
<object class="NSImageCell" key="NSCell" id="334634827">
|
||||
<int key="NSCellFlags">130560</int>
|
||||
<int key="NSCellFlags2">33554432</int>
|
||||
<int key="NSAlign">0</int>
|
||||
<int key="NSScale">2</int>
|
||||
<int key="NSStyle">0</int>
|
||||
<bool key="NSAnimates">NO</bool>
|
||||
</object>
|
||||
<bool key="NSEditable">YES</bool>
|
||||
</object>
|
||||
</object>
|
||||
<string key="NSFrameSize">{389, 380}</string>
|
||||
<reference key="NSSuperview"/>
|
||||
</object>
|
||||
<string key="NSScreenRect">{{0, 0}, {1440, 878}}</string>
|
||||
<string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string>
|
||||
</object>
|
||||
<object class="NSCustomObject" id="635946545">
|
||||
<string key="NSClassName">AppController</string>
|
||||
</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="972006081"/>
|
||||
</object>
|
||||
<int key="connectionID">459</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBOutletConnection" key="connection">
|
||||
<string key="label">ninePartColor</string>
|
||||
<reference key="source" ref="635946545"/>
|
||||
<reference key="destination" ref="100716157"/>
|
||||
</object>
|
||||
<int key="connectionID">480</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBOutletConnection" key="connection">
|
||||
<string key="label">threePartColor</string>
|
||||
<reference key="source" ref="635946545"/>
|
||||
<reference key="destination" ref="688674788"/>
|
||||
</object>
|
||||
<int key="connectionID">481</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBOutletConnection" key="connection">
|
||||
<string key="label">patternColor</string>
|
||||
<reference key="source" ref="635946545"/>
|
||||
<reference key="destination" ref="605260233"/>
|
||||
</object>
|
||||
<int key="connectionID">482</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBOutletConnection" key="connection">
|
||||
<string key="label">simpleColor</string>
|
||||
<reference key="source" ref="635946545"/>
|
||||
<reference key="destination" ref="1066696903"/>
|
||||
</object>
|
||||
<int key="connectionID">483</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBOutletConnection" key="connection">
|
||||
<string key="label">imageView</string>
|
||||
<reference key="source" ref="635946545"/>
|
||||
<reference key="destination" ref="276994718"/>
|
||||
</object>
|
||||
<int key="connectionID">490</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">371</int>
|
||||
<reference key="object" ref="972006081"/>
|
||||
<object class="NSMutableArray" key="children">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference ref="439893737"/>
|
||||
</object>
|
||||
<reference key="parent" ref="0"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">372</int>
|
||||
<reference key="object" ref="439893737"/>
|
||||
<object class="NSMutableArray" key="children">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference ref="385245898"/>
|
||||
<reference ref="1066696903"/>
|
||||
<reference ref="605260233"/>
|
||||
<reference ref="179895693"/>
|
||||
<reference ref="688674788"/>
|
||||
<reference ref="63869060"/>
|
||||
<reference ref="100716157"/>
|
||||
<reference ref="488609560"/>
|
||||
<reference ref="696346150"/>
|
||||
<reference ref="276994718"/>
|
||||
</object>
|
||||
<reference key="parent" ref="972006081"/>
|
||||
</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">468</int>
|
||||
<reference key="object" ref="1066696903"/>
|
||||
<reference key="parent" ref="439893737"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">469</int>
|
||||
<reference key="object" ref="385245898"/>
|
||||
<object class="NSMutableArray" key="children">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference ref="12386750"/>
|
||||
</object>
|
||||
<reference key="parent" ref="439893737"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">470</int>
|
||||
<reference key="object" ref="12386750"/>
|
||||
<reference key="parent" ref="385245898"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">471</int>
|
||||
<reference key="object" ref="605260233"/>
|
||||
<reference key="parent" ref="439893737"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">472</int>
|
||||
<reference key="object" ref="179895693"/>
|
||||
<object class="NSMutableArray" key="children">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference ref="222300836"/>
|
||||
</object>
|
||||
<reference key="parent" ref="439893737"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">473</int>
|
||||
<reference key="object" ref="222300836"/>
|
||||
<reference key="parent" ref="179895693"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">474</int>
|
||||
<reference key="object" ref="688674788"/>
|
||||
<reference key="parent" ref="439893737"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">475</int>
|
||||
<reference key="object" ref="63869060"/>
|
||||
<object class="NSMutableArray" key="children">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference ref="828490958"/>
|
||||
</object>
|
||||
<reference key="parent" ref="439893737"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">476</int>
|
||||
<reference key="object" ref="828490958"/>
|
||||
<reference key="parent" ref="63869060"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">477</int>
|
||||
<reference key="object" ref="100716157"/>
|
||||
<reference key="parent" ref="439893737"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">478</int>
|
||||
<reference key="object" ref="488609560"/>
|
||||
<object class="NSMutableArray" key="children">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference ref="548167261"/>
|
||||
</object>
|
||||
<reference key="parent" ref="439893737"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">479</int>
|
||||
<reference key="object" ref="548167261"/>
|
||||
<reference key="parent" ref="488609560"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">485</int>
|
||||
<reference key="object" ref="696346150"/>
|
||||
<object class="NSMutableArray" key="children">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference ref="30856995"/>
|
||||
</object>
|
||||
<reference key="parent" ref="439893737"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">486</int>
|
||||
<reference key="object" ref="30856995"/>
|
||||
<reference key="parent" ref="696346150"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">487</int>
|
||||
<reference key="object" ref="276994718"/>
|
||||
<object class="NSMutableArray" key="children">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference ref="334634827"/>
|
||||
</object>
|
||||
<reference key="parent" ref="439893737"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">488</int>
|
||||
<reference key="object" ref="334634827"/>
|
||||
<reference key="parent" ref="276994718"/>
|
||||
</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>-3.IBPluginDependency</string>
|
||||
<string>371.IBEditorWindowLastContentRect</string>
|
||||
<string>371.IBPluginDependency</string>
|
||||
<string>371.IBViewEditorWindowController.showingBoundsRectangles</string>
|
||||
<string>371.IBViewEditorWindowController.showingLayoutRectangles</string>
|
||||
<string>371.IBWindowTemplateEditedContentRect</string>
|
||||
<string>371.NSWindowTemplate.visibleAtLaunch</string>
|
||||
<string>371.editorWindowContentRectSynchronizationRect</string>
|
||||
<string>372.IBPluginDependency</string>
|
||||
<string>468.IBPluginDependency</string>
|
||||
<string>468.IBViewBoundsToFrameTransform</string>
|
||||
<string>469.IBPluginDependency</string>
|
||||
<string>469.IBViewBoundsToFrameTransform</string>
|
||||
<string>470.IBPluginDependency</string>
|
||||
<string>471.IBPluginDependency</string>
|
||||
<string>471.IBViewBoundsToFrameTransform</string>
|
||||
<string>472.IBPluginDependency</string>
|
||||
<string>472.IBViewBoundsToFrameTransform</string>
|
||||
<string>473.IBPluginDependency</string>
|
||||
<string>474.IBPluginDependency</string>
|
||||
<string>474.IBViewBoundsToFrameTransform</string>
|
||||
<string>475.IBPluginDependency</string>
|
||||
<string>475.IBViewBoundsToFrameTransform</string>
|
||||
<string>476.IBPluginDependency</string>
|
||||
<string>477.IBPluginDependency</string>
|
||||
<string>477.IBViewBoundsToFrameTransform</string>
|
||||
<string>478.IBPluginDependency</string>
|
||||
<string>478.IBViewBoundsToFrameTransform</string>
|
||||
<string>479.IBPluginDependency</string>
|
||||
<string>485.IBPluginDependency</string>
|
||||
<string>485.IBViewBoundsToFrameTransform</string>
|
||||
<string>486.IBPluginDependency</string>
|
||||
<string>487.IBPluginDependency</string>
|
||||
<string>488.IBPluginDependency</string>
|
||||
</object>
|
||||
<object class="NSMutableArray" key="dict.values">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>{{432, 718}, {389, 380}}</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<boolean value="YES"/>
|
||||
<boolean value="YES"/>
|
||||
<string>{{432, 718}, {389, 380}}</string>
|
||||
<integer value="1"/>
|
||||
<string>{{33, 99}, {480, 360}}</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<object class="NSAffineTransform">
|
||||
<bytes key="NSTransformStruct">AUMXAABDm4AAA</bytes>
|
||||
</object>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<object class="NSAffineTransform">
|
||||
<bytes key="NSTransformStruct">P4AAAL+AAABCPAAAw6gAAA</bytes>
|
||||
</object>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<object class="NSAffineTransform">
|
||||
<bytes key="NSTransformStruct">AUMXAABDgIAAA</bytes>
|
||||
</object>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<object class="NSAffineTransform">
|
||||
<bytes key="NSTransformStruct">P4AAAL+AAABCPAAAw40AAA</bytes>
|
||||
</object>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<object class="NSAffineTransform">
|
||||
<bytes key="NSTransformStruct">AUMXAABDSAAAA</bytes>
|
||||
</object>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<object class="NSAffineTransform">
|
||||
<bytes key="NSTransformStruct">P4AAAL+AAABCPAAAw2EAAA</bytes>
|
||||
</object>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<object class="NSAffineTransform">
|
||||
<bytes key="NSTransformStruct">AUMXAABDAgAAA</bytes>
|
||||
</object>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<object class="NSAffineTransform">
|
||||
<bytes key="NSTransformStruct">P4AAAL+AAABCPAAAwxsAAA</bytes>
|
||||
</object>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<object class="NSAffineTransform">
|
||||
<bytes key="NSTransformStruct">P4AAAL+AAABCUAAAwxYAAA</bytes>
|
||||
</object>
|
||||
<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"/>
|
||||
<object class="NSMutableArray" key="dict.values">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
</object>
|
||||
</object>
|
||||
<nil key="activeLocalization"/>
|
||||
<object class="NSMutableDictionary" key="localizations">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference key="dict.sortedKeys" ref="0"/>
|
||||
<object class="NSMutableArray" key="dict.values">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
</object>
|
||||
</object>
|
||||
<nil key="sourceID"/>
|
||||
<int key="maxID">490</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>
|
||||
<object class="NSMutableDictionary" key="outlets">
|
||||
<string key="NS.key.0">theWindow</string>
|
||||
<string key="NS.object.0">NSWindow</string>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
|
||||
<string key="NS.key.0">theWindow</string>
|
||||
<object class="IBToOneOutletInfo" key="NS.object.0">
|
||||
<string key="name">theWindow</string>
|
||||
<string key="candidateClassName">NSWindow</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBProjectSource</string>
|
||||
<string key="minorKey">./Classes/AppController.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">AppController</string>
|
||||
<object class="NSMutableDictionary" key="outlets">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="NSArray" key="dict.sortedKeys">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>imageView</string>
|
||||
<string>ninePartColor</string>
|
||||
<string>patternColor</string>
|
||||
<string>simpleColor</string>
|
||||
<string>threePartColor</string>
|
||||
</object>
|
||||
<object class="NSMutableArray" key="dict.values">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>id</string>
|
||||
<string>id</string>
|
||||
<string>id</string>
|
||||
<string>id</string>
|
||||
<string>id</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>imageView</string>
|
||||
<string>ninePartColor</string>
|
||||
<string>patternColor</string>
|
||||
<string>simpleColor</string>
|
||||
<string>threePartColor</string>
|
||||
</object>
|
||||
<object class="NSMutableArray" key="dict.values">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="IBToOneOutletInfo">
|
||||
<string key="name">imageView</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo">
|
||||
<string key="name">ninePartColor</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo">
|
||||
<string key="name">patternColor</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo">
|
||||
<string key="name">simpleColor</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo">
|
||||
<string key="name">threePartColor</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBUserSource</string>
|
||||
<string key="minorKey"/>
|
||||
</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>
|
||||
<nil key="IBDocument.LastKnownRelativeProjectPath"/>
|
||||
<int key="IBDocument.defaultPropertyAccessControl">3</int>
|
||||
</data>
|
||||
</archive>
|
||||
|
After Width: | Height: | Size: 1.8 KiB |
|
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
|
||||
test
|
||||
|
||||
Created by aparajita on May 19, 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>CPColor-CPImage-description</title>
|
||||
|
||||
<script type="text/javascript">
|
||||
OBJJ_MAIN_FILE = "main.j";
|
||||
OBJJ_INCLUDE_PATHS = ["Frameworks/Debug", "Frameworks", "SomethingElse"];
|
||||
</script>
|
||||
|
||||
<script type="text/javascript" src="Frameworks/Debug/Objective-J/Objective-J.js" 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 test...</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>
|
||||
@@ -0,0 +1,77 @@
|
||||
<!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
|
||||
test
|
||||
|
||||
Created by aparajita on May 19, 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>CPColor-CPImage-description</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 test...</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>
|
||||
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* AppController.j
|
||||
* test
|
||||
*
|
||||
* Created by aparajita on May 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,361 @@
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 46;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
9EEC4498135749D200615446 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9EEC4497135749D200615446 /* Cocoa.framework */; };
|
||||
9EEC44B5135749D300615446 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9EEC4497135749D200615446 /* Cocoa.framework */; };
|
||||
9EEC44CC13574A0B00615446 /* CPComboBoxTest in Resources */ = {isa = PBXBuildFile; fileRef = 9EEC44CB13574A0B00615446 /* CPComboBoxTest */; };
|
||||
E172BA5013FF420400B03445 /* MainMenu.xib in Sources */ = {isa = PBXBuildFile; fileRef = E172BA4F13FF420400B03445 /* MainMenu.xib */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
9EEC44B6135749D300615446 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 9EEC448A135749D200615446 /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 9EEC4492135749D200615446;
|
||||
remoteInfo = Another;
|
||||
};
|
||||
/* End PBXContainerItemProxy section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
9EEC4493135749D200615446 /* Another.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Another.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
9EEC4497135749D200615446 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
|
||||
9EEC449A135749D300615446 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; };
|
||||
9EEC449B135749D300615446 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; };
|
||||
9EEC449C135749D300615446 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
|
||||
9EEC44B4135749D300615446 /* AnotherTests.octest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = AnotherTests.octest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
9EEC44CB13574A0B00615446 /* CPComboBoxTest */ = {isa = PBXFileReference; lastKnownFileType = folder; name = CPComboBoxTest; path = ..; sourceTree = "<group>"; };
|
||||
E172BA4F13FF420400B03445 /* MainMenu.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = MainMenu.xib; path = ../Resources/MainMenu.xib; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
9EEC4490135749D200615446 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
9EEC4498135749D200615446 /* Cocoa.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
9EEC44B0135749D300615446 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
9EEC44B5135749D300615446 /* Cocoa.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
9EEC4488135749D200615446 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E172BA4F13FF420400B03445 /* MainMenu.xib */,
|
||||
9EEC44CB13574A0B00615446 /* CPComboBoxTest */,
|
||||
9EEC4496135749D200615446 /* Frameworks */,
|
||||
9EEC4494135749D200615446 /* Products */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
9EEC4494135749D200615446 /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
9EEC4493135749D200615446 /* Another.app */,
|
||||
9EEC44B4135749D300615446 /* AnotherTests.octest */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
9EEC4496135749D200615446 /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
9EEC4497135749D200615446 /* Cocoa.framework */,
|
||||
9EEC4499135749D300615446 /* Other Frameworks */,
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
9EEC4499135749D300615446 /* Other Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
9EEC449A135749D300615446 /* AppKit.framework */,
|
||||
9EEC449B135749D300615446 /* CoreData.framework */,
|
||||
9EEC449C135749D300615446 /* Foundation.framework */,
|
||||
);
|
||||
name = "Other Frameworks";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
9EEC4492135749D200615446 /* Another */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 9EEC44C5135749D300615446 /* Build configuration list for PBXNativeTarget "Another" */;
|
||||
buildPhases = (
|
||||
9EEC448F135749D200615446 /* Sources */,
|
||||
9EEC4490135749D200615446 /* Frameworks */,
|
||||
9EEC4491135749D200615446 /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = Another;
|
||||
productName = Another;
|
||||
productReference = 9EEC4493135749D200615446 /* Another.app */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
9EEC44B3135749D300615446 /* AnotherTests */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 9EEC44C8135749D300615446 /* Build configuration list for PBXNativeTarget "AnotherTests" */;
|
||||
buildPhases = (
|
||||
9EEC44AF135749D300615446 /* Sources */,
|
||||
9EEC44B0135749D300615446 /* Frameworks */,
|
||||
9EEC44B1135749D300615446 /* Resources */,
|
||||
9EEC44B2135749D300615446 /* ShellScript */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
9EEC44B7135749D300615446 /* PBXTargetDependency */,
|
||||
);
|
||||
name = AnotherTests;
|
||||
productName = AnotherTests;
|
||||
productReference = 9EEC44B4135749D300615446 /* AnotherTests.octest */;
|
||||
productType = "com.apple.product-type.bundle";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
9EEC448A135749D200615446 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 0420;
|
||||
ORGANIZATIONNAME = "280 North, Inc.";
|
||||
};
|
||||
buildConfigurationList = 9EEC448D135749D200615446 /* Build configuration list for PBXProject "CPComboBoxTest" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
);
|
||||
mainGroup = 9EEC4488135749D200615446;
|
||||
productRefGroup = 9EEC4494135749D200615446 /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
9EEC4492135749D200615446 /* Another */,
|
||||
9EEC44B3135749D300615446 /* AnotherTests */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
9EEC4491135749D200615446 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
9EEC44CC13574A0B00615446 /* CPComboBoxTest in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
9EEC44B1135749D300615446 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
9EEC44B2135749D300615446 /* ShellScript */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "# Run the unit tests in this test bundle.\n\"${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests\"\n";
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
9EEC448F135749D200615446 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
E172BA5013FF420400B03445 /* MainMenu.xib in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
9EEC44AF135749D300615446 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXTargetDependency section */
|
||||
9EEC44B7135749D300615446 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = 9EEC4492135749D200615446 /* Another */;
|
||||
targetProxy = 9EEC44B6135749D300615446 /* PBXContainerItemProxy */;
|
||||
};
|
||||
/* End PBXTargetDependency section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
9EEC44C3135749D300615446 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = DEBUG;
|
||||
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
||||
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.6;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = macosx;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
9EEC44C4135749D300615446 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.6;
|
||||
SDKROOT = macosx;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
9EEC44C6135749D300615446 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = "Another/Another-Prefix.pch";
|
||||
INFOPLIST_FILE = "Another/Another-Info.plist";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
WRAPPER_EXTENSION = app;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
9EEC44C7135749D300615446 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
COPY_PHASE_STRIP = YES;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = "Another/Another-Prefix.pch";
|
||||
INFOPLIST_FILE = "Another/Another-Info.plist";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
WRAPPER_EXTENSION = app;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
9EEC44C9135749D300615446 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/Another.app/Contents/MacOS/Another";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
FRAMEWORK_SEARCH_PATHS = "$(DEVELOPER_LIBRARY_DIR)/Frameworks";
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = "AnotherTests/AnotherTests-Prefix.pch";
|
||||
INFOPLIST_FILE = "AnotherTests/AnotherTests-Info.plist";
|
||||
OTHER_LDFLAGS = (
|
||||
"-framework",
|
||||
SenTestingKit,
|
||||
);
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
TEST_HOST = "$(BUNDLE_LOADER)";
|
||||
WRAPPER_EXTENSION = octest;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
9EEC44CA135749D300615446 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/Another.app/Contents/MacOS/Another";
|
||||
COPY_PHASE_STRIP = YES;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
FRAMEWORK_SEARCH_PATHS = "$(DEVELOPER_LIBRARY_DIR)/Frameworks";
|
||||
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = "AnotherTests/AnotherTests-Prefix.pch";
|
||||
INFOPLIST_FILE = "AnotherTests/AnotherTests-Info.plist";
|
||||
OTHER_LDFLAGS = (
|
||||
"-framework",
|
||||
SenTestingKit,
|
||||
);
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
TEST_HOST = "$(BUNDLE_LOADER)";
|
||||
WRAPPER_EXTENSION = octest;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
9EEC448D135749D200615446 /* Build configuration list for PBXProject "CPComboBoxTest" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
9EEC44C3135749D300615446 /* Debug */,
|
||||
9EEC44C4135749D300615446 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
9EEC44C5135749D300615446 /* Build configuration list for PBXNativeTarget "Another" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
9EEC44C6135749D300615446 /* Debug */,
|
||||
9EEC44C7135749D300615446 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
9EEC44C8135749D300615446 /* Build configuration list for PBXNativeTarget "AnotherTests" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
9EEC44C9135749D300615446 /* Debug */,
|
||||
9EEC44CA135749D300615446 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 9EEC448A135749D200615446 /* Project object */;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "self:CPComboBoxTest.xcodeproj">
|
||||
</FileRef>
|
||||
</Workspace>
|
||||
@@ -0,0 +1,14 @@
|
||||
|
||||
@interface Companies : NSObject
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@end
|
||||
@interface AppController : NSObject
|
||||
{
|
||||
IBOutlet NSWindow* theWindow;
|
||||
IBOutlet NSComboBox* cibCombo;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,14 @@
|
||||
|
||||
@interface Companies : NSObject
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@end
|
||||
@interface AppController : NSObject
|
||||
{
|
||||
IBOutlet NSWindow* theWindow;
|
||||
IBOutlet NSComboBox* cibCombo;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,227 @@
|
||||
/*
|
||||
* 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;
|
||||
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 scroller" 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
|
||||
@@ -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>
|
||||