Added makeObjectsPerformSelector:withObjects:.

Reviewed by me.
This commit is contained in:
Francisco Ryan Tolmasky I
2009-10-30 18:02:33 -07:00
parent df8c648d70
commit 3dbddcf186
2 changed files with 25 additions and 3 deletions
+8 -3
View File
@@ -1050,7 +1050,7 @@ var STICKY_TIME_INTERVAL = 500,
[_menuView setFont:aFont];
}
- (void)setBackgroundStyle:(_CPMenuWindowBackgroundStyle)aBackgroundStyle
+ (CPColor)backgroundColorForBackgroundStyle:(_CPMenuWindowBackgroundStyle)aBackgroundStyle
{
var color = _CPMenuWindowBackgroundColors[aBackgroundStyle];
@@ -1092,8 +1092,13 @@ var STICKY_TIME_INTERVAL = 500,
_CPMenuWindowBackgroundColors[aBackgroundStyle] = color;
}
[self setBackgroundColor:color];
return color;
}
- (void)setBackgroundStyle:(_CPMenuWindowBackgroundStyle)aBackgroundStyle
{
[self setBackgroundColor:[[self class] backgroundColorForBackgroundStyle:aBackgroundStyle]];
}
- (void)setMenu:(CPMenu)aMenu
+17
View File
@@ -602,6 +602,23 @@
objj_msgSend(self[index], aSelector, anObject);
}
- (void)makeObjectsPerformSelector:(SEL)aSelector withObjects:(CPArray)objects
{
if (!aSelector)
[CPException raise:CPInvalidArgumentException reason:"makeObjectsPerformSelector:withObjects: 'aSelector' can't be nil"];
var index = 0,
count = length,
argumentsArray = [nil, aSelector].concat(objects || []);
for(; index < count; ++index)
{
argumentsArray[0] = self[index];
objj_msgSend.apply(this, argumentsArray);
}
}
// Comparing arrays
/*!
Returns the first object found in the receiver (starting at index 0) which is present in the