mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-30 17:50:38 +00:00
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:
parent
0a72d4bd4d
commit
bf12b45df0
8 changed files with 219 additions and 70 deletions
|
@ -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];
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue