mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 07:00:46 +00:00
Add OVERRIDDEN macro per suggestion from @fredkiefer
This commit is contained in:
parent
19e8a48ba3
commit
e754180dcf
1 changed files with 7 additions and 34 deletions
|
@ -67,44 +67,17 @@ APPKIT_DECLARE NSString* NSCollectionViewLayoutKey = @"NSColle
|
|||
|
||||
APPKIT_DECLARE NSCollectionViewSupplementaryElementKind GSNoSupplementaryElement = @"GSNoSupplementaryElement"; // private
|
||||
|
||||
/*
|
||||
* Private helper macro to check, if the method given via the selector sel
|
||||
* has been overridden in the current subclass.
|
||||
*/
|
||||
#define OVERRIDDEN(sel) ([self methodForSelector: @selector(sel)] != [[_collectionViewLayout class] instanceMethodForSelector: @selector(sel)])
|
||||
|
||||
/*
|
||||
* Class variables
|
||||
*/
|
||||
static NSString *_placeholderItem = nil;
|
||||
|
||||
@interface NSObject (CollectionViewInternalPrivate)
|
||||
|
||||
/**
|
||||
* This method is used to determine if the receiver overrides the
|
||||
* given selector.
|
||||
*/
|
||||
- (BOOL) overridesSelector: (SEL)s;
|
||||
|
||||
@end
|
||||
|
||||
@implementation NSObject (CollectionViewInternalPrivate)
|
||||
|
||||
- (BOOL) overridesSelector: (SEL)s
|
||||
{
|
||||
Class osc = [self superclass];
|
||||
BOOL overriden = NO;
|
||||
|
||||
while (osc != nil)
|
||||
{
|
||||
overriden = ([self methodForSelector: s] != [osc instanceMethodForSelector: s]);
|
||||
if (overriden)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
osc = [osc superclass];
|
||||
}
|
||||
|
||||
return overriden;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@interface NSCollectionView (CollectionViewInternalPrivate)
|
||||
|
||||
- (void) _initDefaults;
|
||||
|
@ -1798,7 +1771,7 @@ static NSString *_placeholderItem = nil;
|
|||
}
|
||||
|
||||
// Get the size proposed by the layout...
|
||||
if (_collectionViewLayout != nil && [_collectionViewLayout overridesSelector: @selector(collectionViewContentSize)])
|
||||
if (_collectionViewLayout != nil && OVERRIDDEN(collectionViewContentSize))
|
||||
{
|
||||
ps = [_collectionViewLayout collectionViewContentSize];
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue