Additional NSScroller implementation.

Fix locking/unlocking of focus for view hierarchy.
Numerous bug fixes.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@2255 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
netcrep 1997-03-20 19:23:21 +00:00
parent 0a72d4bd4d
commit bf12b45df0
8 changed files with 219 additions and 70 deletions

View file

@ -259,9 +259,28 @@ NSString *NSViewFocusChangedNotification = @"NSViewFocusChangedNotification";
- (NSView *)ancestorSharedWithView:(NSView *)aView
{
NSView *v = nil;
// Are they the same?
if (self == aView)
return self;
return v;
// Is self a descendant of view?
if ([self isDescendantOf: aView])
return aView;
// Is view a descendant of self?
if ([aView isDescendantOf: self])
return self;
// If neither are descendants of each other
// and either does not have a superview
// then they cannot have a common ancestor
if (![self superview])
return nil;
if (![aView superview])
return nil;
// Find the common ancestor of superviews
return [[self superview] ancestorSharedWithView: [aView superview]];
}
- (BOOL)isDescendantOf:(NSView *)aView
@ -734,11 +753,25 @@ NSString *NSViewFocusChangedNotification = @"NSViewFocusChangedNotification";
//
- (void)lockFocus
{
NSView *s = [self superview];
// lock our superview
if (s)
[s lockFocus];
// push ourselves
[[self class] pushFocusView: self];
}
- (void)unlockFocus
{
NSView *s = [self superview];
// unlock our superview
if (s)
[s unlockFocus];
// pop ourselves
[[self class] popFocusView];
}