Fixed delegate constraining split position

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@15969 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Nicola Pero 2003-02-16 03:19:11 +00:00
parent 4dc81ab769
commit 2f0f4f1d0d

View file

@ -116,10 +116,9 @@ static NSNotificationCenter *nc = nil;
unsigned int eventMask = NSLeftMouseUpMask | NSLeftMouseDraggedMask;
/* YES if delegate implements splitView:constrainSplitPosition:ofSubviewAt:*/
BOOL delegateConstrains = NO;
SEL constrainSel =
@selector(splitView:constrainSplitPosition:ofSubviewAt:);
IMP constrainImp = 0;
SEL constrainSel = @selector(splitView:constrainSplitPosition:ofSubviewAt:);
typedef float (*floatIMP)(id, SEL, id, float, int);
floatIMP constrainImp = NULL;
/* if there are less the two subviews, there is nothing to do */
if (count < 2)
@ -289,7 +288,7 @@ static NSNotificationCenter *nc = nil;
if (delegateConstrains)
{
constrainImp = [_delegate methodForSelector: constrainSel];
constrainImp = (floatIMP)[_delegate methodForSelector: constrainSel];
}
// user is moving the knob loop until left mouse up
@ -300,21 +299,13 @@ static NSNotificationCenter *nc = nil;
{
if (_isVertical)
{
/*
p.x = [_delegate splitView: self constrainSplitPosition: p.x
ofSubviewAt: offset];
*/
(*constrainImp)(_delegate, constrainSel, self,
p.x, offset);
p.x = (*constrainImp)(_delegate, constrainSel, self,
p.x, offset);
}
else
{
/*
p.y = [_delegate splitView: self constrainSplitPosition: p.y
ofSubviewAt: offset];
*/
(*constrainImp)(_delegate, constrainSel, self,
p.y, offset);
p.y = (*constrainImp)(_delegate, constrainSel, self,
p.y, offset);
}
}