Tidyups for protocols

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@17109 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-Macdonald 2003-07-04 17:15:02 +00:00
parent 61aea80cb8
commit d03c09f65b
3 changed files with 99 additions and 9 deletions

View file

@ -1,8 +1,9 @@
2003-07-04 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSPasteboard.m: Add conditionally compiled code to
set protocols for proxy objects. Let's use it when we have
no compilers which break on this.
* Source/NSPasteboard.m: Add code to set protocols for proxy objects.
and dum my class implementations to let protocols work with old
compilers.
* Headers/AppKit/GSPasteboard.h: Add missing method of owner.
2003-07-03 01:43 Alexander Malmberg <alexander@malmberg.org>

View file

@ -81,8 +81,12 @@
* provide additional data.
*/
@protocol GSPasteboardCallback
- (void)pasteboard: (NSPasteboard*)pb provideDataForType:(NSString*)type;
- (void)pasteboard: (NSPasteboard*)pb provideDataForType:(NSString*)type andVersion:(int)v;
- (void) pasteboard: (NSPasteboard*)pb
provideDataForType: (NSString*)type;
- (void) pasteboard: (NSPasteboard*)pb
provideDataForType: (NSString*)type
andVersion:(int)v;
- (void) pasteboardChangedOwner: (NSPasteboard*)pb;
@end
#endif // _GNUstep_H_GSPasteboardServer

View file

@ -960,11 +960,9 @@ static NSMapTable *mimeMap = NULL;
if (RETAIN((id)the_server) != nil)
{
NSConnection *conn = [(id)the_server connectionForProxy];
#if 0 // When compilers work!
Protocol *p = @protocol(GSPasteboardSvr);
[(id)the_server setProtocolForProxy: p];
#endif
[[NSNotificationCenter defaultCenter]
addObserver: self
selector: @selector(_lostServer:)
@ -1115,14 +1113,12 @@ static NSMapTable *mimeMap = NULL;
{
NSPasteboard *ret;
#if 0 // When compilers work
if ([(id)anObj isProxy] == YES)
{
Protocol *p = @protocol(GSPasteboardObj);
[(id)anObj setProtocolForProxy: p];
}
#endif
ret = [self _pasteboardWithTarget: anObj name: aName];
NS_VALRETURN(ret);
}
@ -2106,3 +2102,92 @@ NSGetFileTypes(NSArray *pboardTypes)
return nil;
}
/*
* The following dummy classes are here solely as a workaround for pre 3.3
* versions of gcc where protocols didn't work properly unless implemented
* in the source where the '@protocol()' directive is used.
*/
@interface NSPasteboardServerDummy : NSObject <GSPasteboardSvr>
- (id<GSPasteboardObj>) pasteboardWithName: (in bycopy NSString*)name;
@end
@implementation NSPasteboardServerDummy
- (id<GSPasteboardObj>) pasteboardWithName: (in bycopy NSString*)name
{
return nil;
}
@end
@interface NSPasteboardObjectDummy : NSObject <GSPasteboardObj>
- (int) addTypes: (in bycopy NSArray*)types
owner: (id)owner
pasteboard: (NSPasteboard*)pb
oldCount: (int)count;
- (NSString*) availableTypeFromArray: (in bycopy NSArray*)types
changeCount: (int*)count;
- (int) changeCount;
- (NSData*) dataForType: (in bycopy NSString*)type
oldCount: (int)count
mustBeCurrent: (BOOL)flag;
- (int) declareTypes: (in bycopy NSArray*)types
owner: (id)owner
pasteboard: (NSPasteboard*)pb;
- (NSString*) name;
- (void) releaseGlobally;
- (BOOL) setData: (in bycopy NSData*)data
forType: (in bycopy NSString*)type
isFile: (BOOL)flag
oldCount: (int)count;
- (void) setHistory: (unsigned)length;
- (bycopy NSArray*) typesAndChangeCount: (int*)count;
@end
@implementation NSPasteboardObjectDummy
- (int) addTypes: (in bycopy NSArray*)types
owner: (id)owner
pasteboard: (NSPasteboard*)pb
oldCount: (int)count
{
return 0;
}
- (NSString*) availableTypeFromArray: (in bycopy NSArray*)types
changeCount: (int*)count
{
return nil;
}
- (int) changeCount
{
return 0;
}
- (NSData*) dataForType: (in bycopy NSString*)type
oldCount: (int)count
mustBeCurrent: (BOOL)flag
{
return nil;
}
- (int) declareTypes: (in bycopy NSArray*)types
owner: (id)owner
pasteboard: (NSPasteboard*)pb
{
return 0;
}
- (NSString*) name
{
return nil;
}
- (void) releaseGlobally
{
}
- (BOOL) setData: (in bycopy NSData*)data
forType: (in bycopy NSString*)type
isFile: (BOOL)flag
oldCount: (int)count
{
return NO;
}
- (void) setHistory: (unsigned)length
{
}
- (bycopy NSArray*) typesAndChangeCount: (int*)count
{
return nil;
}
@end