* Source/NSSplitView.m: Use resize cursors

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@33040 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Eric Wasylishen 2011-05-15 04:24:20 +00:00
parent 947ed83d99
commit d84b435d98
2 changed files with 52 additions and 0 deletions

View file

@ -1,3 +1,7 @@
2011-05-14 Eric Wasylishen <ewasylishen@gmail.com>
* Source/NSSplitView.m: Use resize cursors
2011-05-14 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSPrintOperation.m: Add an extra context save and restore

View file

@ -46,6 +46,7 @@
#import "AppKit/NSApplication.h"
#import "AppKit/NSColor.h"
#import "AppKit/NSCursor.h"
#import "AppKit/NSEvent.h"
#import "AppKit/NSGraphics.h"
#import "AppKit/NSImage.h"
@ -422,6 +423,7 @@ static NSNotificationCenter *nc = nil;
BOOL liveResize = ![[NSUserDefaults standardUserDefaults] boolForKey: @"GSUseGhostResize"];
NSRect oldRect; //only one can be dragged at a time
BOOL lit = NO;
NSCursor *cursor;
/* if there are less the two subviews, there is nothing to do */
if (count < 2)
@ -530,6 +532,7 @@ static NSNotificationCenter *nc = nil;
/* set the default limits on the dragging */
minCoord = NSMinY(bigRect) + divVertical;
maxCoord = NSHeight(bigRect) + NSMinY(bigRect) - divVertical;
cursor = [NSCursor resizeUpDownCursor];
}
else
{
@ -538,8 +541,11 @@ static NSNotificationCenter *nc = nil;
/* set the default limits on the dragging */
minCoord = NSMinX(bigRect) + divHorizontal;
maxCoord = NSWidth(bigRect) + NSMinX(bigRect) - divHorizontal;
cursor = [NSCursor resizeLeftRightCursor];
}
[cursor push];
/* find out what the dragging limit is */
if (_delegate)
{
@ -742,6 +748,8 @@ static NSNotificationCenter *nc = nil;
[self setNeedsDisplay: YES];
[NSCursor pop];
//[self display];
}
@ -1232,6 +1240,46 @@ static inline NSPoint centerSizeInRect(NSSize innerSize, NSRect outerRect)
SET_DELEGATE_NOTIFICATION(WillResizeSubviews);
}
- (void) resetCursorRects
{
NSArray *subs = [self subviews];
NSInteger i;
const NSInteger count = [subs count];
const NSRect visibleRect = [self visibleRect];
NSCursor *cursor;
if (_isVertical)
{
cursor = [NSCursor resizeLeftRightCursor];
}
else
{
cursor = [NSCursor resizeUpDownCursor];
}
for (i = 0; i < (count-1); i++)
{
NSView *v = [subs objectAtIndex: i];
NSRect divRect = [v frame];
if (_isVertical == NO)
{
divRect.origin.y = NSMaxY (divRect);
divRect.size.height = _dividerWidth;
}
else
{
divRect.origin.x = NSMaxX (divRect);
divRect.size.width = _dividerWidth;
}
divRect = NSIntersectionRect(divRect, visibleRect);
if (!NSEqualRects(NSZeroRect, divRect))
{
[self addCursorRect: divRect cursor: cursor];
}
}
}
/*
* NSCoding protocol
*/