Mercurial > projects > dwt-mac
diff dwt/internal/cocoa/NSImage.d @ 1:8b48be5454ce
The internal cocoa classes compile now
author | Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com> |
---|---|
date | Tue, 19 Aug 2008 17:35:17 +0200 |
parents | 380af2bdd8e5 |
children | f565d3a95c0a |
line wrap: on
line diff
--- a/dwt/internal/cocoa/NSImage.d Sat Aug 09 17:00:02 2008 +0200 +++ b/dwt/internal/cocoa/NSImage.d Tue Aug 19 17:35:17 2008 +0200 @@ -22,6 +22,7 @@ import dwt.internal.cocoa.NSData; import dwt.internal.cocoa.NSDictionary; import dwt.internal.cocoa.NSImageRep; +import dwt.internal.cocoa.NSInteger; import dwt.internal.cocoa.NSObject; import dwt.internal.cocoa.NSPasteboard; import dwt.internal.cocoa.NSPoint; @@ -32,7 +33,7 @@ import dwt.internal.cocoa.OS; import objc = dwt.internal.objc.runtime; -enum NSCompositingOperation +enum NSCompositingOperation : NSUInteger { NSCompositeClear = 0, NSCompositeCopy = 1, @@ -50,7 +51,22 @@ NSCompositePlusLighter = 13 } -enum NSImageCacheMode +alias NSCompositingOperation.NSCompositeClear NSCompositeClear; +alias NSCompositingOperation.NSCompositeCopy NSCompositeCopy; +alias NSCompositingOperation.NSCompositeSourceOver NSCompositeSourceOver; +alias NSCompositingOperation.NSCompositeSourceIn NSCompositeSourceIn; +alias NSCompositingOperation.NSCompositeSourceOut NSCompositeSourceOut; +alias NSCompositingOperation.NSCompositeSourceAtop NSCompositeSourceAtop; +alias NSCompositingOperation.NSCompositeDestinationOver NSCompositeDestinationOver; +alias NSCompositingOperation.NSCompositeDestinationIn NSCompositeDestinationIn; +alias NSCompositingOperation.NSCompositeDestinationOut NSCompositeDestinationOut; +alias NSCompositingOperation.NSCompositeDestinationAtop NSCompositeDestinationAtop; +alias NSCompositingOperation.NSCompositeXOR NSCompositeXOR; +alias NSCompositingOperation.NSCompositePlusDarker NSCompositePlusDarker; +alias NSCompositingOperation.NSCompositeHighlight NSCompositeHighlight; +alias NSCompositingOperation.NSCompositePlusLighter NSCompositePlusLighter; + +enum NSImageCacheMode : NSUInteger { NSImageCacheDefault, NSImageCacheAlways, @@ -58,6 +74,11 @@ NSImageCacheNever } +alias NSImageCacheMode.NSImageCacheDefault NSImageCacheDefault; +alias NSImageCacheMode.NSImageCacheAlways NSImageCacheAlways; +alias NSImageCacheMode.NSImageCacheBySize NSImageCacheBySize; +alias NSImageCacheMode.NSImageCacheNever NSImageCacheNever; + public class NSImage : NSObject { @@ -73,114 +94,114 @@ public NSData TIFFRepresentation () { - objc.id result = OS.objc_msgSend(this.id, OS.sel_TIFFRepresentation); + objc.id result = OS.objc_msgSend(this.id_, OS.sel_TIFFRepresentation); return result !is null ? new NSData(result) : null; } public NSData TIFFRepresentationUsingCompression (NSTIFFCompression comp, float aFloat) { - objc.id result = OS.objc_msgSend(this.id, OS.sel_TIFFRepresentationUsingCompression_1factor_1, comp, aFloat); + objc.id result = OS.objc_msgSend(this.id_, OS.sel_TIFFRepresentationUsingCompression_1factor_1, comp, aFloat); return result !is null ? new NSData(result) : null; } public void addRepresentation (NSImageRep imageRep) { - OS.objc_msgSend(this.id, OS.sel_addRepresentation_1, imageRep !is null ? imageRep.id : null); + OS.objc_msgSend(this.id_, OS.sel_addRepresentation_1, imageRep !is null ? imageRep.id_ : null); } public void addRepresentations (NSArray imageReps) { - OS.objc_msgSend(this.id, OS.sel_addRepresentations_1, imageReps !is null ? imageReps.id : null); + OS.objc_msgSend(this.id_, OS.sel_addRepresentations_1, imageReps !is null ? imageReps.id_ : null); } public NSRect alignmentRect () { NSRect result; - OS.objc_msgSend_stret(result, this.id, OS.sel_alignmentRect); + OS.objc_msgSend_stret(&result, this.id_, OS.sel_alignmentRect); return result; } public NSColor backgroundColor () { - objc.id result = OS.objc_msgSend(this.id, OS.sel_backgroundColor); + objc.id result = OS.objc_msgSend(this.id_, OS.sel_backgroundColor); return result !is null ? new NSColor(result) : null; } public NSImageRep bestRepresentationForDevice (NSDictionary deviceDescription) { - objc.id result = OS.objc_msgSend(this.id, OS.sel_bestRepresentationForDevice_1, deviceDescription !is null ? deviceDescription.id : null); + objc.id result = OS.objc_msgSend(this.id_, OS.sel_bestRepresentationForDevice_1, deviceDescription !is null ? deviceDescription.id_ : null); return result !is null ? new NSImageRep(result) : null; } public bool cacheDepthMatchesImageDepth () { - return OS.objc_msgSend(this.id, OS.sel_cacheDepthMatchesImageDepth) !is null; + return OS.objc_msgSend(this.id_, OS.sel_cacheDepthMatchesImageDepth) !is null; } public NSImageCacheMode cacheMode () { - return OS.objc_msgSend(this.id, OS.sel_cacheMode); + return cast(NSImageCacheMode) OS.objc_msgSend(this.id_, OS.sel_cacheMode); } public static bool canInitWithPasteboard (NSPasteboard pasteboard) { - return OS.objc_msgSend(OS.class_NSImage, OS.sel_canInitWithPasteboard_1, pasteboard !is null ? pasteboard.id : null) !is null; + return OS.objc_msgSend(OS.class_NSImage, OS.sel_canInitWithPasteboard_1, pasteboard !is null ? pasteboard.id_ : null) !is null; } public void cancelIncrementalLoad () { - OS.objc_msgSend(this.id, OS.sel_cancelIncrementalLoad); + OS.objc_msgSend(this.id_, OS.sel_cancelIncrementalLoad); } public void compositeToPoint_fromRect_operation_ (NSPoint point, NSRect rect, NSCompositingOperation op) { - OS.objc_msgSend(this.id, OS.sel_compositeToPoint_1fromRect_1operation_1, point, rect, op); + OS.objc_msgSend(this.id_, OS.sel_compositeToPoint_1fromRect_1operation_1, point, rect, op); } public void compositeToPoint_fromRect_operation_fraction_ (NSPoint point, NSRect rect, NSCompositingOperation op, CGFloat delta) { - OS.objc_msgSend(this.id, OS.sel_compositeToPoint_1fromRect_1operation_1fraction_1, point, rect, op, delta); + OS.objc_msgSend(this.id_, OS.sel_compositeToPoint_1fromRect_1operation_1fraction_1, point, rect, op, delta); } public void compositeToPoint_operation_ (NSPoint point, NSCompositingOperation op) { - OS.objc_msgSend(this.id, OS.sel_compositeToPoint_1operation_1, point, op); + OS.objc_msgSend(this.id_, OS.sel_compositeToPoint_1operation_1, point, op); } public void compositeToPoint_operation_fraction_ (NSPoint point, NSCompositingOperation op, CGFloat delta) { - OS.objc_msgSend(this.id, OS.sel_compositeToPoint_1operation_1fraction_1, point, op, delta); + OS.objc_msgSend(this.id_, OS.sel_compositeToPoint_1operation_1fraction_1, point, op, delta); } public id delegatee () { - objc.id result = OS.objc_msgSend(this.id, OS.sel_delegate); + objc.id result = OS.objc_msgSend(this.id_, OS.sel_delegate); return result !is null ? new id(result) : null; } public void dissolveToPoint_fraction_ (NSPoint point, CGFloat aFloat) { - OS.objc_msgSend(this.id, OS.sel_dissolveToPoint_1fraction_1, point, aFloat); + OS.objc_msgSend(this.id_, OS.sel_dissolveToPoint_1fraction_1, point, aFloat); } public void dissolveToPoint_fromRect_fraction_ (NSPoint point, NSRect rect, CGFloat aFloat) { - OS.objc_msgSend(this.id, OS.sel_dissolveToPoint_1fromRect_1fraction_1, point, rect, aFloat); + OS.objc_msgSend(this.id_, OS.sel_dissolveToPoint_1fromRect_1fraction_1, point, rect, aFloat); } public void drawAtPoint (NSPoint point, NSRect fromRect, NSCompositingOperation op, CGFloat delta) { - OS.objc_msgSend(this.id, OS.sel_drawAtPoint_1fromRect_1operation_1fraction_1, point, fromRect, op, delta); + OS.objc_msgSend(this.id_, OS.sel_drawAtPoint_1fromRect_1operation_1fraction_1, point, fromRect, op, delta); } public void drawInRect (NSRect rect, NSRect fromRect, NSCompositingOperation op, CGFloat delta) { - OS.objc_msgSend(this.id, OS.sel_drawInRect_1fromRect_1operation_1fraction_1, rect, fromRect, op, delta); + OS.objc_msgSend(this.id_, OS.sel_drawInRect_1fromRect_1operation_1fraction_1, rect, fromRect, op, delta); } public bool drawRepresentation (NSImageRep imageRep, NSRect rect) { - return OS.objc_msgSend(this.id, OS.sel_drawRepresentation_1inRect_1, imageRep !is null ? imageRep.id : null, rect) !is null; + return OS.objc_msgSend(this.id_, OS.sel_drawRepresentation_1inRect_1, imageRep !is null ? imageRep.id_ : null, rect) !is null; } public static NSArray imageFileTypes () @@ -191,7 +212,7 @@ public static id imageNamed (NSString name) { - objc.id result = OS.objc_msgSend(OS.class_NSImage, OS.sel_imageNamed_1, name !is null ? name.id : null); + objc.id result = OS.objc_msgSend(OS.class_NSImage, OS.sel_imageNamed_1, name !is null ? name.id_ : null); return result !is null ? new id(result) : null; } @@ -227,214 +248,214 @@ public NSImage initByReferencingFile (NSString fileName) { - objc.id result = OS.objc_msgSend(this.id, OS.sel_initByReferencingFile_1, fileName !is null ? fileName.id : null); + objc.id result = OS.objc_msgSend(this.id_, OS.sel_initByReferencingFile_1, fileName !is null ? fileName.id_ : null); return result !is null ? this : null; } public NSImage initByReferencingURL (NSURL url) { - objc.id result = OS.objc_msgSend(this.id, OS.sel_initByReferencingURL_1, url !is null ? url.id : null); + objc.id result = OS.objc_msgSend(this.id_, OS.sel_initByReferencingURL_1, url !is null ? url.id_ : null); return result !is null ? this : null; } public NSImage initWithContentsOfFile (NSString fileName) { - objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithContentsOfFile_1, fileName !is null ? fileName.id : null); + objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithContentsOfFile_1, fileName !is null ? fileName.id_ : null); return result !is null ? this : null; } public NSImage initWithContentsOfURL (NSURL url) { - objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithContentsOfURL_1, url !is null ? url.id : null); + objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithContentsOfURL_1, url !is null ? url.id_ : null); return result !is null ? this : null; } public NSImage initWithData (NSData data) { - objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithData_1, data !is null ? data.id : null); + objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithData_1, data !is null ? data.id_ : null); return result !is null ? this : null; } public NSImage initWithIconRef (IconRef iconRef) { - objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithIconRef_1, iconRef); + objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithIconRef_1, iconRef); return result !is null ? this : null; } public NSImage initWithPasteboard (NSPasteboard pasteboard) { - objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithPasteboard_1, pasteboard !is null ? pasteboard.id : null); + objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithPasteboard_1, pasteboard !is null ? pasteboard.id_ : null); return result !is null ? this : null; } public NSImage initWithSize (NSSize aSize) { - objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithSize_1, aSize); + objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithSize_1, aSize); return result !is null ? this : null; } public bool isCachedSeparately () { - return OS.objc_msgSend(this.id, OS.sel_isCachedSeparately) !is null; + return OS.objc_msgSend(this.id_, OS.sel_isCachedSeparately) !is null; } public bool isDataRetained () { - return OS.objc_msgSend(this.id, OS.sel_isDataRetained) !is null; + return OS.objc_msgSend(this.id_, OS.sel_isDataRetained) !is null; } public bool isFlipped () { - return OS.objc_msgSend(this.id, OS.sel_isFlipped) !is null; + return OS.objc_msgSend(this.id_, OS.sel_isFlipped) !is null; } public bool isTemplate () { - return OS.objc_msgSend(this.id, OS.sel_isTemplate) !is null; + return OS.objc_msgSend(this.id_, OS.sel_isTemplate) !is null; } public bool isValid () { - return OS.objc_msgSend(this.id, OS.sel_isValid) !is null; + return OS.objc_msgSend(this.id_, OS.sel_isValid) !is null; } public void lockFocus () { - OS.objc_msgSend(this.id, OS.sel_lockFocus); + OS.objc_msgSend(this.id_, OS.sel_lockFocus); } public void lockFocusOnRepresentation (NSImageRep imageRepresentation) { - OS.objc_msgSend(this.id, OS.sel_lockFocusOnRepresentation_1, imageRepresentation !is null ? imageRepresentation.id : null); + OS.objc_msgSend(this.id_, OS.sel_lockFocusOnRepresentation_1, imageRepresentation !is null ? imageRepresentation.id_ : null); } public bool matchesOnMultipleResolution () { - return OS.objc_msgSend(this.id, OS.sel_matchesOnMultipleResolution) !is null; + return OS.objc_msgSend(this.id_, OS.sel_matchesOnMultipleResolution) !is null; } public NSString name () { - objc.id result = OS.objc_msgSend(this.id, OS.sel_name); + objc.id result = OS.objc_msgSend(this.id_, OS.sel_name); return result !is null ? new NSString(result) : null; } public bool prefersColorMatch () { - return OS.objc_msgSend(this.id, OS.sel_prefersColorMatch) !is null; + return OS.objc_msgSend(this.id_, OS.sel_prefersColorMatch) !is null; } public void recache () { - OS.objc_msgSend(this.id, OS.sel_recache); + OS.objc_msgSend(this.id_, OS.sel_recache); } public void removeRepresentation (NSImageRep imageRep) { - OS.objc_msgSend(this.id, OS.sel_removeRepresentation_1, imageRep !is null ? imageRep.id : null); + OS.objc_msgSend(this.id_, OS.sel_removeRepresentation_1, imageRep !is null ? imageRep.id_ : null); } public NSArray representations () { - objc.id result = OS.objc_msgSend(this.id, OS.sel_representations); + objc.id result = OS.objc_msgSend(this.id_, OS.sel_representations); return result !is null ? new NSArray(result) : null; } public bool scalesWhenResized () { - return OS.objc_msgSend(this.id, OS.sel_scalesWhenResized) !is null; + return OS.objc_msgSend(this.id_, OS.sel_scalesWhenResized) !is null; } public void setAlignmentRect (NSRect rect) { - OS.objc_msgSend(this.id, OS.sel_setAlignmentRect_1, rect); + OS.objc_msgSend(this.id_, OS.sel_setAlignmentRect_1, rect); } public void setBackgroundColor (NSColor aColor) { - OS.objc_msgSend(this.id, OS.sel_setBackgroundColor_1, aColor !is null ? aColor.id : null); + OS.objc_msgSend(this.id_, OS.sel_setBackgroundColor_1, aColor !is null ? aColor.id_ : null); } public void setCacheDepthMatchesImageDepth (bool flag) { - OS.objc_msgSend(this.id, OS.sel_setCacheDepthMatchesImageDepth_1, flag); + OS.objc_msgSend(this.id_, OS.sel_setCacheDepthMatchesImageDepth_1, flag); } public void setCacheMode (NSImageCacheMode mode) { - OS.objc_msgSend(this.id, OS.sel_setCacheMode_1, mode); + OS.objc_msgSend(this.id_, OS.sel_setCacheMode_1, mode); } public void setCachedSeparately (bool flag) { - OS.objc_msgSend(this.id, OS.sel_setCachedSeparately_1, flag); + OS.objc_msgSend(this.id_, OS.sel_setCachedSeparately_1, flag); } public void setDataRetained (bool flag) { - OS.objc_msgSend(this.id, OS.sel_setDataRetained_1, flag); + OS.objc_msgSend(this.id_, OS.sel_setDataRetained_1, flag); } public void setDelegate (id anObject) { - OS.objc_msgSend(this.id, OS.sel_setDelegate_1, anObject !is null ? anObject.id : null); + OS.objc_msgSend(this.id_, OS.sel_setDelegate_1, anObject !is null ? anObject.id_ : null); } public void setFlipped (bool flag) { - OS.objc_msgSend(this.id, OS.sel_setFlipped_1, flag); + OS.objc_msgSend(this.id_, OS.sel_setFlipped_1, flag); } public void setMatchesOnMultipleResolution (bool flag) { - OS.objc_msgSend(this.id, OS.sel_setMatchesOnMultipleResolution_1, flag); + OS.objc_msgSend(this.id_, OS.sel_setMatchesOnMultipleResolution_1, flag); } public bool setName (NSString string) { - return OS.objc_msgSend(this.id, OS.sel_setName_1, string !is null ? string.id : null) !is null; + return OS.objc_msgSend(this.id_, OS.sel_setName_1, string !is null ? string.id_ : null) !is null; } public void setPrefersColorMatch (bool flag) { - OS.objc_msgSend(this.id, OS.sel_setPrefersColorMatch_1, flag); + OS.objc_msgSend(this.id_, OS.sel_setPrefersColorMatch_1, flag); } public void setScalesWhenResized (bool flag) { - OS.objc_msgSend(this.id, OS.sel_setScalesWhenResized_1, flag); + OS.objc_msgSend(this.id_, OS.sel_setScalesWhenResized_1, flag); } public void setSize (NSSize aSize) { - OS.objc_msgSend(this.id, OS.sel_setSize_1, aSize); + OS.objc_msgSend(this.id_, OS.sel_setSize_1, aSize); } public void setTemplate (bool isTemplate) { - OS.objc_msgSend(this.id, OS.sel_setTemplate_1, isTemplate); + OS.objc_msgSend(this.id_, OS.sel_setTemplate_1, isTemplate); } public void setUsesEPSOnResolutionMismatch (bool flag) { - OS.objc_msgSend(this.id, OS.sel_setUsesEPSOnResolutionMismatch_1, flag); + OS.objc_msgSend(this.id_, OS.sel_setUsesEPSOnResolutionMismatch_1, flag); } public NSSize size () { NSSize result; - OS.objc_msgSend_struct(result, this.id, OS.sel_size); + OS.objc_msgSend_struct(&result, this.id_, OS.sel_size); return result; } public void unlockFocus () { - OS.objc_msgSend(this.id, OS.sel_unlockFocus); + OS.objc_msgSend(this.id_, OS.sel_unlockFocus); } public bool usesEPSOnResolutionMismatch () { - return OS.objc_msgSend(this.id, OS.sel_usesEPSOnResolutionMismatch) !is null; + return OS.objc_msgSend(this.id_, OS.sel_usesEPSOnResolutionMismatch) !is null; } }