Mercurial > projects > dwt-mac
diff dwt/internal/cocoa/NSImageRep.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 diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/cocoa/NSImageRep.d Sat Aug 09 17:00:02 2008 +0200 @@ -0,0 +1,249 @@ +/******************************************************************************* + * 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.NSImageRep; + +import dwt.internal.cocoa.id; +import dwt.internal.cocoa.NSArray; +import dwt.internal.cocoa.NSData; +import dwt.internal.cocoa.NSInteger; +import dwt.internal.cocoa.NSObject; +import dwt.internal.cocoa.NSPasteboard; +import dwt.internal.cocoa.NSPoint; +import dwt.internal.cocoa.NSRect; +import dwt.internal.cocoa.NSSize; +import dwt.internal.cocoa.NSString; +import dwt.internal.cocoa.NSURL; +import dwt.internal.cocoa.OS; +import objc = dwt.internal.objc.runtime; + +public class NSImageRep : NSObject +{ + + public this () + { + super(); + } + + public this (objc.id id) + { + super(id); + } + + public NSInteger bitsPerSample () + { + return OS.objc_msgSend(this.id, OS.sel_bitsPerSample); + } + + public static bool canInitWithData (NSData data) + { + return OS.objc_msgSend(OS.class_NSImageRep, OS.sel_canInitWithData_1, data !is null ? data.id : null) !is null; + } + + public static bool canInitWithPasteboard (NSPasteboard pasteboard) + { + return OS.objc_msgSend(OS.class_NSImageRep, OS.sel_canInitWithPasteboard_1, pasteboard !is null ? pasteboard.id : null) !is null; + } + + public NSString colorSpaceName () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_colorSpaceName); + return result !is null ? new NSString(result) : null; + } + + public bool draw () + { + return OS.objc_msgSend(this.id, OS.sel_draw) !is null; + } + + public bool drawAtPoint (NSPoint point) + { + return OS.objc_msgSend(this.id, OS.sel_drawAtPoint_1, point) !is null; + } + + public bool drawInRect (NSRect rect) + { + return OS.objc_msgSend(this.id, OS.sel_drawInRect_1, rect) !is null; + } + + public bool hasAlpha () + { + return OS.objc_msgSend(this.id, OS.sel_hasAlpha) !is null; + } + + public static NSArray imageFileTypes () + { + objc.id result = OS.objc_msgSend(OS.class_NSImageRep, OS.sel_imageFileTypes); + return result !is null ? new NSArray(result) : null; + } + + public static NSArray imagePasteboardTypes () + { + objc.id result = OS.objc_msgSend(OS.class_NSImageRep, OS.sel_imagePasteboardTypes); + return result !is null ? new NSArray(result) : null; + } + + public static objc.Class imageRepClassForData (NSData data) + { + return OS.objc_msgSend(OS.class_NSImageRep, OS.sel_imageRepClassForData_1, data !is null ? data.id : null); + } + + public static objc.Class imageRepClassForFileType (NSString type) + { + return OS.objc_msgSend(OS.class_NSImageRep, OS.sel_imageRepClassForFileType_1, type !is null ? type.id : null); + } + + public static objc.Class imageRepClassForPasteboardType (NSString type) + { + return OS.objc_msgSend(OS.class_NSImageRep, OS.sel_imageRepClassForPasteboardType_1, type !is null ? type.id : null); + } + + public static objc.Class imageRepClassForType (NSString type) + { + return OS.objc_msgSend(OS.class_NSImageRep, OS.sel_imageRepClassForType_1, type !is null ? type.id : null); + } + + public static id imageRepWithContentsOfFile (NSString filename) + { + objc.id result = OS.objc_msgSend(OS.class_NSImageRep, OS.sel_imageRepWithContentsOfFile_1, filename !is null ? filename.id : null); + return result !is null ? new id(result) : null; + } + + public static id imageRepWithContentsOfURL (NSURL url) + { + objc.id result = OS.objc_msgSend(OS.class_NSImageRep, OS.sel_imageRepWithContentsOfURL_1, url !is null ? url.id : null); + return result !is null ? new id(result) : null; + } + + public static id imageRepWithPasteboard (NSPasteboard pasteboard) + { + objc.id result = OS.objc_msgSend(OS.class_NSImageRep, OS.sel_imageRepWithPasteboard_1, pasteboard !is null ? pasteboard.id : null); + return result !is null ? new id(result) : null; + } + + public static NSArray imageRepsWithContentsOfFile (NSString filename) + { + objc.id result = OS.objc_msgSend(OS.class_NSImageRep, OS.sel_imageRepsWithContentsOfFile_1, filename !is null ? filename.id : null); + return result !is null ? new NSArray(result) : null; + } + + public static NSArray imageRepsWithContentsOfURL (NSURL url) + { + objc.id result = OS.objc_msgSend(OS.class_NSImageRep, OS.sel_imageRepsWithContentsOfURL_1, url !is null ? url.id : null); + return result !is null ? new NSArray(result) : null; + } + + public static NSArray imageRepsWithPasteboard (NSPasteboard pasteboard) + { + objc.id result = OS.objc_msgSend(OS.class_NSImageRep, OS.sel_imageRepsWithPasteboard_1, pasteboard !is null ? pasteboard.id : null); + return result !is null ? new NSArray(result) : null; + } + + public static NSArray imageTypes () + { + objc.id result = OS.objc_msgSend(OS.class_NSImageRep, OS.sel_imageTypes); + return result !is null ? new NSArray(result) : null; + } + + public static NSArray imageUnfilteredFileTypes () + { + objc.id result = OS.objc_msgSend(OS.class_NSImageRep, OS.sel_imageUnfilteredFileTypes); + return result !is null ? new NSArray(result) : null; + } + + public static NSArray imageUnfilteredPasteboardTypes () + { + objc.id result = OS.objc_msgSend(OS.class_NSImageRep, OS.sel_imageUnfilteredPasteboardTypes); + return result !is null ? new NSArray(result) : null; + } + + public static NSArray imageUnfilteredTypes () + { + objc.id result = OS.objc_msgSend(OS.class_NSImageRep, OS.sel_imageUnfilteredTypes); + return result !is null ? new NSArray(result) : null; + } + + public bool isOpaque () + { + return OS.objc_msgSend(this.id, OS.sel_isOpaque) !is null; + } + + public NSInteger pixelsHigh () + { + return OS.objc_msgSend(this.id, OS.sel_pixelsHigh); + } + + public NSInteger pixelsWide () + { + return OS.objc_msgSend(this.id, OS.sel_pixelsWide); + } + + public static void registerImageRepClass (objc.Class imageRepClass) + { + OS.objc_msgSend(OS.class_NSImageRep, OS.sel_registerImageRepClass_1, imageRepClass); + } + + public static NSArray registeredImageRepClasses () + { + objc.id result = OS.objc_msgSend(OS.class_NSImageRep, OS.sel_registeredImageRepClasses); + return result !is null ? new NSArray(result) : null; + } + + public void setAlpha (bool flag) + { + OS.objc_msgSend(this.id, OS.sel_setAlpha_1, flag); + } + + public void setBitsPerSample (NSInteger anInt) + { + OS.objc_msgSend(this.id, OS.sel_setBitsPerSample_1, anInt); + } + + public void setColorSpaceName (NSString string) + { + OS.objc_msgSend(this.id, OS.sel_setColorSpaceName_1, string !is null ? string.id : null); + } + + public void setOpaque (bool flag) + { + OS.objc_msgSend(this.id, OS.sel_setOpaque_1, flag); + } + + public void setPixelsHigh (NSInteger anInt) + { + OS.objc_msgSend(this.id, OS.sel_setPixelsHigh_1, anInt); + } + + public void setPixelsWide (NSInteger anInt) + { + OS.objc_msgSend(this.id, OS.sel_setPixelsWide_1, anInt); + } + + public void setSize (NSSize aSize) + { + OS.objc_msgSend(this.id, OS.sel_setSize_1, aSize); + } + + public NSSize size () + { + NSSize result; + OS.objc_msgSend_stret(result, this.id, OS.sel_size); + return result; + } + + public static void unregisterImageRepClass (objc.Class imageRepClass) + { + OS.objc_msgSend(OS.class_NSImageRep, OS.sel_unregisterImageRepClass_1, imageRepClass); + } + +}