Merge branch '0.9.1' of github.com:280north/cappuccino into 0.9.1

This commit is contained in:
Alexander Ljungberg
2011-04-21 20:01:53 -04:00
8 changed files with 144 additions and 50 deletions
+8 -2
View File
@@ -243,9 +243,15 @@ var STICKY_TIME_INTERVAL = 500,
// Close the current menu item because we are going to select a new one after a short delay
[self showMenu:nil fromMenu:activeMenu atPoint:CGPointMakeZero()];
_showTimerID = setTimeout(function() {
if (![activeMenuContainer isMenuBar])
{
_showTimerID = setTimeout(function() {
[self showMenu:[activeItem submenu] fromMenu:[activeItem menu] atPoint:newMenuOrigin];
}, 250);
}
else
[self showMenu:[activeItem submenu] fromMenu:[activeItem menu] atPoint:newMenuOrigin];
}, 250);
}
}
+44 -26
View File
@@ -739,41 +739,59 @@ var CPSplitViewHorizontalImage = nil,
Sets the delegate of the receiver.
Possible delegate methods to implement are listed below.
<pre>
- (void)splitViewDidResizeSubviews:(CPSplitView)aSplitView;
Notifies the delegate when the subviews have resized.
Notifies the delegate when the subviews have resized.
@code
- (void)splitViewDidResizeSubviews:(CPNotification)aNotification;
@endcode
- (void)splitViewWillResizeSubviews:(CPSplitView)aSplitView;
Notifies the delegate when the subviews will be resized.
Notifies the delegate when the subviews will be resized.
@code
- (void)splitViewWillResizeSubviews:(CPNotification)aNotification;
@endcode
- (CGRect)splitView:(CPSplitView)aSplitView effectiveRect:(CGRect)aRect forDrawnRect:(CGRect)aDrawnRect ofDividerAtIndex:(int)aDividerIndex;
Lets the delegate specify a different rect for which the user can drag the splitView divider.
Lets the delegate specify a different rect for which the user can drag the splitView divider.
@code
- (CGRect)splitView:(CPSplitView)aSplitView effectiveRect:(CGRect)aRect forDrawnRect:(CGRect)aDrawnRect ofDividerAtIndex:(int)aDividerIndex;
@endcode
- (CGRect)splitView:(CPSplitView)aSplitView additionalEffectiveRectOfDividerAtIndex:(int)indexOfDivider;
Lets the delegate specify an additional rect for which the user can drag the splitview divider.
Lets the delegate specify an additional rect for which the user can drag the splitview divider.
@code
- (CGRect)splitView:(CPSplitView)aSplitView additionalEffectiveRectOfDividerAtIndex:(int)indexOfDivider;
@endcode
- (BOOL)splitView:(CPSplitView)aSplitView canCollapseSubview:(CPView)aSubview;
Notifies the delegate that the splitview is about to be collapsed. This usually happens when the user
Double clicks on the divider. Return YES if the subview can be collapsed, otherwise NO.
Notifies the delegate that the splitview is about to be collapsed. This usually happens when the user
Double clicks on the divider. Return YES if the subview can be collapsed, otherwise NO.
@code
- (BOOL)splitView:(CPSplitView)aSplitView canCollapseSubview:(CPView)aSubview;
@endcode
- (BOOL)splitView:(CPSplitView)aSplitView shouldCollapseSubview:(CPView)aSubview forDoubleClickOnDividerAtIndex:(int)indexOfDivider;
Notifies the delegate that the subview at indexOfDivider is about to be collapsed. This usually happens when the user
Double clicks on the divider. Return YES if the subview should be collapsed, otherwise NO.
Notifies the delegate that the subview at indexOfDivider is about to be collapsed. This usually happens when the user
Double clicks on the divider. Return YES if the subview should be collapsed, otherwise NO.
@code
- (BOOL)splitView:(CPSplitView)aSplitView shouldCollapseSubview:(CPView)aSubview forDoubleClickOnDividerAtIndex:(int)indexOfDivider;
@endcode
- (float)splitView:(CPSplitView)aSpiltView constrainSplitPosition:(float)proposedPosition ofSubviewAt:(int)subviewIndex;
Allows the delegate to constrain the subview beings resized. This method is called continuously as the user resizes the divider.
For example if the subview needs to have a width which is a multiple of a certain number you could return that multiple with this method.
Allows the delegate to constrain the subview beings resized. This method is called continuously as the user resizes the divider.
For example if the subview needs to have a width which is a multiple of a certain number you could return that multiple with this method.
@code
- (float)splitView:(CPSplitView)aSpiltView constrainSplitPosition:(float)proposedPosition ofSubviewAt:(int)subviewIndex;
@endcode
- (float)splitView:(CPSplitView)aSplitView constrainMinCoordinate:(float)proposedMin ofSubviewAt:(int)subviewIndex;
Allows the delegate to constrain the minimum position of a subview.
Allows the delegate to constrain the minimum position of a subview.
@code
- (float)splitView:(CPSplitView)aSplitView constrainMinCoordinate:(float)proposedMin ofSubviewAt:(int)subviewIndex;
@endcode
- (float)splitView:(CPSplitView)aSplitView constrainMaxCoordinate:(float)proposedMax ofSubviewAt:(int)subviewIndex;
Allows the delegate to constrain the maximum position of a subview.
Allows the delegate to constrain the maximum position of a subview.
@code
- (float)splitView:(CPSplitView)aSplitView constrainMaxCoordinate:(float)proposedMax ofSubviewAt:(int)subviewIndex;
@endcode
- (void)splitView:(CPSplitView)aSplitView resizeSubviewsWithOldSize:(CGSize)oldSize;
Allows the splitview to specify a custom resizing behavior. This is called when the splitview is resized.
The sum of the views and the sum of the dividers should be equal to the size of the splitview.
</pre>
Allows the splitview to specify a custom resizing behavior. This is called when the splitview is resized.
The sum of the views and the sum of the dividers should be equal to the size of the splitview.
@code
- (void)splitView:(CPSplitView)aSplitView resizeSubviewsWithOldSize:(CGSize)oldSize;
@endcode
@param delegate - The delegate of the splitview.
*/
+17 -13
View File
@@ -193,24 +193,24 @@ var SHADOW_MARGIN_LEFT = 20.0,
_CPWindowShadowColor = nil;
var CPWindowSaveImage = nil,
CPWindowSavingImage = nil;
CPWindowSavingImage = nil,
var CPWindowResizeTime = 0.2;
CPWindowResizeTime = 0.2;
/*
Keys for which action messages will be sent by default when unhandled, e.g. complete:.
*/
var CPWindowActionMessageKeys = [
CPLeftArrowFunctionKey,
CPRightArrowFunctionKey,
CPUpArrowFunctionKey,
CPDownArrowFunctionKey,
CPPageUpFunctionKey,
CPPageDownFunctionKey,
CPHomeFunctionKey,
CPEndFunctionKey,
CPEscapeFunctionKey
];
CPLeftArrowFunctionKey,
CPRightArrowFunctionKey,
CPUpArrowFunctionKey,
CPDownArrowFunctionKey,
CPPageUpFunctionKey,
CPPageDownFunctionKey,
CPHomeFunctionKey,
CPEndFunctionKey,
CPEscapeFunctionKey
];
/*!
@ingroup appkit
@@ -2377,7 +2377,9 @@ CPTexturedBackgroundWindowMask
// an event going of the responder chain is passed to the input system as a last resort.
// However, the only methods I could get Cocoa to call automatically are
// moveUp: moveDown: moveLeft: moveRight: pageUp: pageDown: and complete:
[self _processKeyboardUIKey:anEvent];
// Unhandled events just travel further up the responder chain _past_ the window.
if (![self _processKeyboardUIKey:anEvent])
[super keyDown:anEvent];
}
/*
@@ -2412,6 +2414,8 @@ CPTexturedBackgroundWindowMask
// The difference is that doCommandBySelector: will also send the action to the window and application delegates.
[[self firstResponder] doCommandBySelector:@selector(complete:)];
}
return NO;
}
- (void)_dirtyKeyViewLoop
+1 -1
View File
@@ -606,7 +606,7 @@ function CGContextStrokeLineSegments(aContext, points, count)
{
var i = 0;
if (arguments["count"] == NULL)
if (count === NULL)
var count = points.length;
CGContextBeginPath(aContext);
+3 -3
View File
@@ -144,7 +144,7 @@ function CGContextAddRects(aContext, rects, count)
{
var i = 0;
if (arguments["count"] == NULL)
if (count === NULL)
var count = rects.length;
for (; i < count; ++i)
@@ -194,7 +194,7 @@ function CGContextFillRects(aContext, rects, count)
{
var i = 0;
if (arguments["count"] == NULL)
if (count === NULL)
var count = rects.length;
for (; i < count; ++i)
@@ -225,7 +225,7 @@ function CGContextClipToRect(aContext, aRect)
function CGContextClipToRects(aContext, rects, count)
{
if (arguments["count"] == NULL)
if (count === NULL)
var count = rects.length;
_CGContextBeginPathCanvas(aContext);
+3 -3
View File
@@ -29,10 +29,10 @@ kCGGradientDrawsAfterEndLocation = 1 << 1;
function CGGradientCreateWithColorComponents(aColorSpace, components, locations, count)
{
if (arguments["locations"] == NULL)
if (locations === NULL)
var locations = [0.0, 1.0];
if (arguments["count"] == NULL)
if (count === NULL)
var count = locations.length;
var colors = [];
@@ -58,4 +58,4 @@ function CGGradientRelease()
function CGGradientRetain(aGradient)
{
return aGradient;
}
}
+2 -2
View File
@@ -141,7 +141,7 @@ function CGPathAddLines(aPath, aTransform, points, count)
{
var i = 1;
if (arguments["count"] == NULL)
if (count === NULL)
var count = points.length;
if (!aPath || count < 2)
@@ -224,7 +224,7 @@ function CGPathAddRects(aPath, aTransform, rects, count)
{
var i = 0;
if (arguments["count"] == NULL)
if (count === NULL)
var count = rects.length;
for (; i < count; ++i)
+66
View File
@@ -0,0 +1,66 @@
@import <AppKit/CGGradient.j>
@implementation CGGradientTest : OJTestCase
/*
Using default values for location and count.
*/
- (void)testCreateWithColorComponentsDefault
{
var components = [ 0.2,0.2,0.4,0.4,
0.6,0.6,0.8,0.8 ];
var tmp = CGGradientCreateWithColorComponents(CGColorSpaceCreateDeviceRGB(),
components);
[self assert:2 equals:tmp.colors.length];
[self assert:2 equals:tmp.locations.length];
[self assert:0 equals:tmp.locations[0]];
[self assert:1.0 equals:tmp.locations[1]];
[self assert:components.slice(4,8) equals:tmp.colors[1].components];
[self assert:components.slice(0,4) equals:tmp.colors[0].components];
}
/*
Using location and components to specify two color stops that aren't
evenly spread out.
*/
- (void)testCreateWithColorComponentsUsingTwoColorStops
{
var components = [ 0.2,0.2,0.4,0.4,
0.6,0.6,0.8,0.8 ];
var locations = [0.3,0.6];
var tmp = CGGradientCreateWithColorComponents(CGColorSpaceCreateDeviceRGB(),
components,locations);
[self assert:2 equals:tmp.colors.length];
[self assert:2 equals:tmp.locations.length];
[self assert:0.3 equals:tmp.locations[0]];
[self assert:0.6 equals:tmp.locations[1]];
[self assert:components.slice(4,8) equals:tmp.colors[1].components];
[self assert:components.slice(0,4) equals:tmp.colors[0].components];
}
/*
Define three color components and ensure that the Gradient defined contains 3 color stops.
*/
- (void)testCanHaveMoreThanTwoColorStops
{
var components = [ 1,2,3,4, 5,6,7,8, 9,10,11,12 ];
var locations = [1,2,3];
var tmp = CGGradientCreateWithColorComponents(CGColorSpaceCreateDeviceRGB(),
components, locations, 3);
[self assert:3 equals:tmp.colors.length];
[self assert:3 equals:tmp.locations.length];
[self assert:1 equals:tmp.locations[0]];
[self assert:2 equals:tmp.locations[1]];
[self assert:3 equals:tmp.locations[2]];
}
@end