Further reorg.

Reviewed by me.
This commit is contained in:
Francisco Ryan Tolmasky I committed 2008-12-26 23:54:20 -08:00
1 parent 3afd7a9a69
commit b29dc6052e
4 files changed
+33 -31

No files matched your search

+1
View File
@@ -369,6 +369,7 @@ var CPSplitViewHorizontalImage = nil,
- (void)mouseDown:(CPEvent)anEvent
{
// FIXME: This should not trap events if not on a divider!
[self trackDivider:anEvent];
}
-25
View File
@@ -525,31 +525,6 @@ CPTexturedBackgroundWindowMask
[_delegate windowDidResize:self];
}
/*
@ignore
*/
- (void)trackMoveWithEvent:(CPEvent)anEvent
{
var type = [anEvent type];
if (type == CPLeftMouseUp)
return;
else if (type == CPLeftMouseDown)
_mouseDraggedPoint = [self convertBaseToBridge:[anEvent locationInWindow]];
else if (type == CPLeftMouseDragged)
{
var location = [self convertBaseToBridge:[anEvent locationInWindow]];
[self setFrameOrigin:CGPointMake(_CGRectGetMinX(_frame) + (location.x - _mouseDraggedPoint.x), _CGRectGetMinY(_frame) + (location.y - _mouseDraggedPoint.y))];
_mouseDraggedPoint = location;
}
[CPApp setTarget:self selector:@selector(trackMoveWithEvent:) 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
+2 -2
View File
@@ -277,9 +277,9 @@ var STANDARD_GRADIENT_HEIGHT = 41.0;
- (void)mouseDown:(CPEvent)anEvent
{
if (CGRectContainsPoint([_headView frame], [self convertPoint:[anEvent locationInWindow] fromView:nil]))
[[self owningWindow] trackMoveWithEvent:anEvent];
return [self trackMoveWithEvent:anEvent];
return [super mouseDown:anEvent];
[super mouseDown:anEvent];
}
@end
+30 -4
View File
@@ -23,6 +23,8 @@
@import "CPView.j"
@import "CPImageView.j"
#include "../CoreGraphics/CGGeometry.h"
var _CPWindowViewResizeIndicatorImage = nil;
@@ -36,6 +38,9 @@ var _CPWindowViewResizeIndicatorImage = nil;
CPView _toolbarView;
CPWindow _owningWindow;
CGRect _resizeFrame;
CGPoint _mouseDraggedPoint;
}
+ (void)initialize
@@ -111,15 +116,12 @@ var _CPWindowViewResizeIndicatorImage = nil;
}
if ([theWindow isMovableByWindowBackground])
[theWindow trackMoveWithEvent:anEvent];
[self trackMoveWithEvent:anEvent];
else
[super mouseDown:anEvent];
}
/*
@ignore
*/
- (void)trackResizeWithEvent:(CPEvent)anEvent
{
var location = [anEvent locationInWindow],
@@ -143,6 +145,30 @@ var _CPWindowViewResizeIndicatorImage = nil;
[CPApp setTarget:self selector:@selector(trackResizeWithEvent:) forNextEventMatchingMask:CPLeftMouseDraggedMask | CPLeftMouseUpMask untilDate:nil inMode:nil dequeue:YES];
}
- (void)trackMoveWithEvent:(CPEvent)anEvent
{
var type = [anEvent type];
if (type === CPLeftMouseUp)
return;
else if (type === CPLeftMouseDown)
_mouseDraggedPoint = [[self owningWindow] convertBaseToBridge:[anEvent locationInWindow]];
else if (type === CPLeftMouseDragged)
{
var theWindow = [self owningWindow],
location = [theWindow convertBaseToBridge:[anEvent locationInWindow]],
frame = [theWindow frame];
[theWindow setFrameOrigin:CGPointMake(_CGRectGetMinX(frame) + (location.x - _mouseDraggedPoint.x), _CGRectGetMinY(frame) + (location.y - _mouseDraggedPoint.y))];
_mouseDraggedPoint = location;
}
[CPApp setTarget:self selector:@selector(trackMoveWithEvent:) forNextEventMatchingMask:CPLeftMouseDraggedMask | CPLeftMouseUpMask untilDate:nil inMode:nil dequeue:YES];
}
- (void)setShowsResizeIndicator:(BOOL)shouldShowResizeIndicator
{
if (shouldShowResizeIndicator)