mirror of
https://github.com/gnustep/libs-gdl2.git
synced 2025-02-19 17:50:47 +00:00
* GDL2Palette/KeyWrapper.m: Ditto. * GDL2Palette/ConnectionInspector.h * GDL2Palette/ConnectionInspector.m (init): Initialize _values. (-awakeFromNib): Update handling of horizontal scroller. (-_associationClassesUsableWithObject:): Implement. (-setObject:): Fix assignment issues. (-_keysFromClassDescription:): Implement. (-_keysFromArray:): Ditto. (-updateValues): Reimplement. (-_oaBrowserAction:): Ditto. (-browser:numberOfRowsInColumn:): Refine implementation. (-browser:willDisplayCell:atRow:column:): Reimplement. (-ok:): Update associations in active document. * GDL2Palette/ResourceManager.m (defaultEditingContext): Try to find defaultEditingContext in document objects. (addResourcesFromPasteboard:): Reimplement. * GDL2Palette/Foundation+Categories.m: (arrayWithObjectsRespondingYesToSelector:): Fix leak. (arrayWithObjectsRespondingYesToSelector:withObject:): Ditto. * GDL2Palette/GNUmakefile: Use PALETTE_LIBS instead of ADDITIONAL_LDFLAGS to link libraries. Add new files. * GDL2Palette/GDL2Palette.tiff: New file. * GDL2Palette/GDL2ConnectionInspector.gorm: New files. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gdl2/trunk@23398 72102866-910b-0410-8b05-ffd578937521
73 lines
1.5 KiB
Objective-C
73 lines
1.5 KiB
Objective-C
#include "Foundation+Categories.h"
|
|
|
|
/* since we don't really have blocks and i don't feel like including them.. */
|
|
@implementation NSArray (GDL2PaletteAdditions)
|
|
|
|
- (NSArray *) arrayWithObjectsRespondingYesToSelector:(SEL)selector;
|
|
{
|
|
int i,c = [self count];
|
|
BOOL (*sel_imp)(id, SEL, ...);
|
|
NSMutableArray *arr = [NSMutableArray arrayWithCapacity: c];
|
|
BOOL flag;
|
|
|
|
for (i = 0; i < c; i++)
|
|
{
|
|
id obj = [self objectAtIndex:i];
|
|
|
|
flag = [obj respondsToSelector:selector];
|
|
|
|
if (flag)
|
|
{
|
|
sel_imp = (BOOL (*)(id, SEL, ...))[obj methodForSelector:selector];
|
|
flag = (*sel_imp)(obj, selector);
|
|
|
|
if (flag)
|
|
[arr addObject:obj];
|
|
}
|
|
}
|
|
return arr;
|
|
}
|
|
|
|
- (NSArray *) arrayWithObjectsRespondingYesToSelector:(SEL)selector
|
|
withObject:(id)argument;
|
|
{
|
|
int i,c = [self count];
|
|
BOOL (*sel_imp)(id, SEL, ...);
|
|
NSMutableArray *arr = [NSMutableArray arrayWithCapacity: c];
|
|
BOOL flag;
|
|
|
|
for (i = 0; i < c; i++)
|
|
{
|
|
id obj = [self objectAtIndex:i];
|
|
|
|
flag = [obj respondsToSelector:selector];
|
|
|
|
if (flag)
|
|
{
|
|
sel_imp = (BOOL (*)(id, SEL, ...))[obj methodForSelector:selector];
|
|
flag = (*sel_imp)(obj, selector, argument);
|
|
|
|
if (flag)
|
|
[arr addObject:obj];
|
|
}
|
|
}
|
|
return arr;
|
|
}
|
|
|
|
@end
|
|
|
|
@implementation NSObject(GDL2PaletteAdditions)
|
|
- (BOOL) isKindOfClasses:(NSArray *)classes
|
|
{
|
|
int i,c;
|
|
|
|
for (i = 0, c = [classes count]; i < c; i++)
|
|
{
|
|
if ([self isKindOfClass: [classes objectAtIndex:i]])
|
|
return YES;
|
|
}
|
|
return NO;
|
|
}
|
|
|
|
@end
|
|
|