A bit more CPWindow code reorg.

Reviewed by me.
This commit is contained in:
Francisco Ryan Tolmasky I committed 2008-12-26 21:35:10 -08:00
1 parent 3305385311
commit 3afd7a9a69
2 files changed
+28 -22

No files matched your search

-20
View File
@@ -550,26 +550,6 @@ CPTexturedBackgroundWindowMask
[CPApp setTarget:self selector:@selector(trackMoveWithEvent:) forNextEventMatchingMask:CPLeftMouseDraggedMask | CPLeftMouseUpMask untilDate:nil inMode:nil dequeue:YES];
}
/*
@ignore
*/
- (void)trackResizeWithEvent:(CPEvent)anEvent
{
var location = [anEvent locationInWindow],
type = [anEvent type];
if (type == CPLeftMouseUp)
return;
else if (type == CPLeftMouseDown)
_resizeFrame = CGRectMake(location.x, location.y, CGRectGetWidth(_frame), CGRectGetHeight(_frame));
else if (type == CPLeftMouseDragged)
[self setFrameSize:CGSizeMake(CGRectGetWidth(_resizeFrame) + location.x - CGRectGetMinX(_resizeFrame), CGRectGetHeight(_resizeFrame) + location.y - CGRectGetMinY(_resizeFrame))];
[CPApp setTarget:self selector:@selector(trackResizeWithEvent:) forNextEventMatchingMask:CPLeftMouseDraggedMask | CPLeftMouseUpMask untilDate:nil inMode:nil dequeue:YES];
}
/*!
Makes the receiver the front most window in the screen ordering.
@param aSender the object that requested this
+28 -2
View File
@@ -99,7 +99,7 @@ var _CPWindowViewResizeIndicatorImage = nil;
- (void)mouseDown:(CPEvent)anEvent
{
var theWindow = [self window];
var theWindow = [self owningWindow];
if ((_styleMask & CPResizableWindowMask) && _resizeIndicator)
{
@@ -107,7 +107,7 @@ var _CPWindowViewResizeIndicatorImage = nil;
var frame = [_resizeIndicator frame];
if (CGRectContainsPoint(frame, [self convertPoint:[anEvent locationInWindow] fromView:nil]))
return [theWindow trackResizeWithEvent:anEvent];
return [self trackResizeWithEvent:anEvent];
}
if ([theWindow isMovableByWindowBackground])
@@ -117,6 +117,32 @@ var _CPWindowViewResizeIndicatorImage = nil;
[super mouseDown:anEvent];
}
/*
@ignore
*/
- (void)trackResizeWithEvent:(CPEvent)anEvent
{
var location = [anEvent locationInWindow],
type = [anEvent type];
if (type === CPLeftMouseUp)
return;
var theWindow = [self owningWindow];
if (type === CPLeftMouseDown)
{
var frame = [theWindow frame];
_resizeFrame = CGRectMake(location.x, location.y, CGRectGetWidth(frame), CGRectGetHeight(frame));
}
else if (type === CPLeftMouseDragged)
[theWindow setFrameSize:CGSizeMake(CGRectGetWidth(_resizeFrame) + location.x - CGRectGetMinX(_resizeFrame), CGRectGetHeight(_resizeFrame) + location.y - CGRectGetMinY(_resizeFrame))];
[CPApp setTarget:self selector:@selector(trackResizeWithEvent:) forNextEventMatchingMask:CPLeftMouseDraggedMask | CPLeftMouseUpMask untilDate:nil inMode:nil dequeue:YES];
}
- (void)setShowsResizeIndicator:(BOOL)shouldShowResizeIndicator
{
if (shouldShowResizeIndicator)