Mercurial > projects > dwt-mac
view dwt/internal/cocoa/NSPasteboard.d @ 0:380af2bdd8e5
Upload of whole dwt tree
author | Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com> |
---|---|
date | Sat, 09 Aug 2008 17:00:02 +0200 |
parents | |
children | 8b48be5454ce |
line wrap: on
line source
/******************************************************************************* * Copyright (c) 2007 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation * * Port to the D Programming language: * Jacob Carlborg <jacob.carlborg@gmail.com> *******************************************************************************/ module dwt.internal.cocoa.NSPasteboard; import dwt.internal.cocoa.NSArray; import dwt.internal.cocoa.NSData; import dwt.internal.cocoa.NSFileWrapper; import dwt.internal.cocoa.NSInteger; import dwt.internal.cocoa.NSObject; import dwt.internal.cocoa.NSString; import dwt.internal.cocoa.OS; import objc = dwt.internal.objc.runtime; public class NSPasteboard : NSObject { public this () { super(); } public this (objc.id id) { super(id); } public NSInteger addTypes (NSArray newTypes, id newOwner) { return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_addTypes_1owner_1, newTypes !is null ? newTypes.id : null, newOwner !is null ? newOwner.id : null); } public NSString availableTypeFromArray (NSArray types) { objc.id result = OS.objc_msgSend(this.id, OS.sel_availableTypeFromArray_1, types !is null ? types.id : null); return result !is null ? new NSString(result) : null; } public NSInteger changeCount () { return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_changeCount); } public NSData dataForType (NSString dataType) { objc.id result = OS.objc_msgSend(this.id, OS.sel_dataForType_1, dataType !is null ? dataType.id : null); return result !is null ? new NSData(result) : null; } public NSInteger declareTypes (NSArray newTypes, id newOwner) { return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_declareTypes_1owner_1, newTypes !is null ? newTypes.id : null, newOwner !is null ? newOwner.id : null); } public static NSPasteboard generalPasteboard () { objc.id result = OS.objc_msgSend(OS.class_NSPasteboard, OS.sel_generalPasteboard); return result !is null ? new NSPasteboard(result) : null; } public NSString name () { objc.id result = OS.objc_msgSend(this.id, OS.sel_name); return result !is null ? new NSString(result) : null; } public static NSPasteboard pasteboardByFilteringData (NSData data, NSString type) { objc.id result = OS.objc_msgSend(OS.class_NSPasteboard, OS.sel_pasteboardByFilteringData_1ofType_1, data !is null ? data.id : null, type !is null ? type.id : null); return result !is null ? new NSPasteboard(result) : null; } public static NSPasteboard pasteboardByFilteringFile (NSString filename) { objc.id result = OS.objc_msgSend(OS.class_NSPasteboard, OS.sel_pasteboardByFilteringFile_1, filename !is null ? filename.id : null); return result !is null ? new NSPasteboard(result) : null; } public static NSPasteboard pasteboardByFilteringTypesInPasteboard (NSPasteboard pboard) { objc.id result = OS.objc_msgSend(OS.class_NSPasteboard, OS.sel_pasteboardByFilteringTypesInPasteboard_1, pboard !is null ? pboard.id : null); return result !is null ? new NSPasteboard(result) : null; } public static NSPasteboard pasteboardWithName (NSString name) { objc.id result = OS.objc_msgSend(OS.class_NSPasteboard, OS.sel_pasteboardWithName_1, name !is null ? name.id : null); return result !is null ? new NSPasteboard(result) : null; } public static NSPasteboard pasteboardWithUniqueName () { objc.id result = OS.objc_msgSend(OS.class_NSPasteboard, OS.sel_pasteboardWithUniqueName); return result !is null ? new NSPasteboard(result) : null; } public id propertyListForType (NSString dataType) { objc.id result = OS.objc_msgSend(this.id, OS.sel_propertyListForType_1, dataType !is null ? dataType.id : null); return result !is null ? new id(result) : null; } public NSString readFileContentsType (NSString type, NSString filename) { objc.id result = OS.objc_msgSend(this.id, OS.sel_readFileContentsType_1toFile_1, type !is null ? type.id : null, filename !is null ? filename.id : null); return result !is null ? new NSString(result) : null; } public NSFileWrapper readFileWrapper () { objc.id result = OS.objc_msgSend(this.id, OS.sel_readFileWrapper); return result !is null ? new NSFileWrapper(result) : null; } public void releaseGlobally () { OS.objc_msgSend(this.id, OS.sel_releaseGlobally); } public bool setData (NSData data, NSString dataType) { return OS.objc_msgSend(this.id, OS.sel_setData_1forType_1, data !is null ? data.id : null, dataType !is null ? dataType.id : null) !is null; } public bool setPropertyList (id plist, NSString dataType) { return OS.objc_msgSend(this.id, OS.sel_setPropertyList_1forType_1, plist !is null ? plist.id : null, dataType !is null ? dataType.id : null) !is null; } public bool setString (NSString string, NSString dataType) { return OS.objc_msgSend(this.id, OS.sel_setString_1forType_1, string !is null ? string.id : null, dataType !is null ? dataType.id : null) !is null; } public NSString stringForType (NSString dataType) { objc.id result = OS.objc_msgSend(this.id, OS.sel_stringForType_1, dataType !is null ? dataType.id : null); return result !is null ? new NSString(result) : null; } public NSArray types () { objc.id result = OS.objc_msgSend(this.id, OS.sel_types); return result !is null ? new NSArray(result) : null; } public static NSArray typesFilterableTo (NSString type) { objc.id result = OS.objc_msgSend(OS.class_NSPasteboard, OS.sel_typesFilterableTo_1, type !is null ? type.id : null); return result !is null ? new NSArray(result) : null; } public bool writeFileContents (NSString filename) { return OS.objc_msgSend(this.id, OS.sel_writeFileContents_1, filename !is null ? filename.id : null) !is null; } public bool writeFileWrapper (NSFileWrapper wrapper) { return OS.objc_msgSend(this.id, OS.sel_writeFileWrapper_1, wrapper !is null ? wrapper.id : null) !is null; } }