1997-09-11 13:53:20 +00:00
|
|
|
#include <Foundation/NSRunLoop.h>
|
|
|
|
#include <Foundation/NSData.h>
|
1998-01-09 23:51:46 +00:00
|
|
|
#include <Foundation/NSArray.h>
|
|
|
|
#include <Foundation/NSAutoreleasePool.h>
|
1998-11-06 04:01:33 +00:00
|
|
|
#include <Foundation/NSGeometry.h>
|
1997-09-11 13:53:20 +00:00
|
|
|
#include <AppKit/NSPasteboard.h>
|
|
|
|
|
1998-08-04 15:43:00 +00:00
|
|
|
BOOL
|
|
|
|
initialize_gnustep_backend(void)
|
|
|
|
{
|
|
|
|
/* Dummy replacement for the xdps function */
|
|
|
|
return YES;
|
|
|
|
}
|
1998-11-06 04:01:33 +00:00
|
|
|
void NSHighlightRect(NSRect aRect) // dummy define
|
|
|
|
{}
|
|
|
|
void NSRectFill(NSRect aRect) // dummy define
|
|
|
|
{}
|
|
|
|
void NSBeep(void) // dummy define
|
|
|
|
{}
|
1998-08-04 15:43:00 +00:00
|
|
|
|
|
|
|
@interface GMModel: NSObject
|
|
|
|
{
|
|
|
|
}
|
|
|
|
@end
|
|
|
|
|
|
|
|
@implementation GMModel
|
|
|
|
@end
|
|
|
|
|
1997-09-11 13:53:20 +00:00
|
|
|
@interface pbOwner : NSObject
|
|
|
|
{
|
|
|
|
}
|
|
|
|
- (void) pasteboard: (NSPasteboard*)pb provideDataForType: (NSString*)type;
|
|
|
|
@end
|
|
|
|
|
|
|
|
@implementation pbOwner
|
|
|
|
- (void) pasteboard: (NSPasteboard*)pb provideDataForType: (NSString*)type
|
|
|
|
{
|
|
|
|
if ([type isEqual: NSFileContentsPboardType]) {
|
|
|
|
NSString* s = [pb stringForType: NSStringPboardType];
|
|
|
|
|
|
|
|
if (s) {
|
|
|
|
const char* ptr;
|
|
|
|
int len;
|
|
|
|
NSData* d;
|
|
|
|
|
1998-01-09 23:51:46 +00:00
|
|
|
ptr = [s cString];
|
1997-09-11 13:53:20 +00:00
|
|
|
len = strlen(ptr);
|
|
|
|
d = [NSData dataWithBytes: ptr length: len];
|
|
|
|
[pb setData: d forType: type];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@end
|
|
|
|
|
|
|
|
int
|
|
|
|
main(int argc, char** argv)
|
|
|
|
{
|
|
|
|
pbOwner *owner = [pbOwner new];
|
|
|
|
NSPasteboard *pb;
|
|
|
|
NSArray *types;
|
|
|
|
NSData *d;
|
|
|
|
|
|
|
|
[NSObject enableDoubleReleaseCheck: YES];
|
|
|
|
|
|
|
|
types = [NSArray arrayWithObjects:
|
|
|
|
NSStringPboardType, NSFileContentsPboardType, nil];
|
|
|
|
pb = [NSPasteboard generalPasteboard];
|
|
|
|
[pb declareTypes: types owner: owner];
|
|
|
|
[pb setString: @"This is a test" forType: NSStringPboardType];
|
|
|
|
d = [pb dataForType: NSFileContentsPboardType];
|
|
|
|
printf("%.*s\n", [d length], [d bytes]);
|
|
|
|
exit(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|