Mercurial > projects > dwt-mac
comparison dwt/internal/cocoa/NSImage.d @ 60:62202ce0039f
Updated and fixed many modules to 3.514
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Mon, 22 Dec 2008 15:10:19 +0100 |
parents | d8635bb48c7c |
children |
comparison
equal
deleted
inserted
replaced
59:83b0ad9d9238 | 60:62202ce0039f |
---|---|
25 import dwt.internal.cocoa.NSSize; | 25 import dwt.internal.cocoa.NSSize; |
26 import dwt.internal.cocoa.NSString; | 26 import dwt.internal.cocoa.NSString; |
27 import dwt.internal.cocoa.OS; | 27 import dwt.internal.cocoa.OS; |
28 import dwt.internal.objc.cocoa.Cocoa; | 28 import dwt.internal.objc.cocoa.Cocoa; |
29 import objc = dwt.internal.objc.runtime; | 29 import objc = dwt.internal.objc.runtime; |
30 | |
31 enum NSImageCacheMode | |
32 { | |
33 NSImageCacheDefault, | |
34 NSImageCacheAlways, | |
35 NSImageCacheBySize, | |
36 NSImageCacheNever | |
37 } | |
38 | 30 |
39 public class NSImage : NSObject { | 31 public class NSImage : NSObject { |
40 | 32 |
41 public this() { | 33 public this() { |
42 super(); | 34 super(); |
77 return result is this.id ? this : (result !is null ? new NSImage(result) : null); | 69 return result is this.id ? this : (result !is null ? new NSImage(result) : null); |
78 } | 70 } |
79 | 71 |
80 public cocoa.id initWithData(NSData data) { | 72 public cocoa.id initWithData(NSData data) { |
81 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithData_, data !is null ? data.id : null); | 73 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithData_, data !is null ? data.id : null); |
82 return result !is null ? new id(result) : null; | 74 return result !is null ? new cocoa.id(result) : null; |
83 } | 75 } |
84 | 76 |
85 public NSImage initWithSize(NSSize aSize) { | 77 public NSImage initWithSize(NSSize aSize) { |
86 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithSize_, aSize); | 78 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithSize_, aSize); |
87 return result is this.id ? this : (result !is null ? new NSImage(result) : null); | 79 return result is this.id ? this : (result !is null ? new NSImage(result) : null); |
95 OS.objc_msgSend(this.id, OS.sel_setSize_, aSize); | 87 OS.objc_msgSend(this.id, OS.sel_setSize_, aSize); |
96 } | 88 } |
97 | 89 |
98 public NSSize size() { | 90 public NSSize size() { |
99 NSSize result = NSSize(); | 91 NSSize result = NSSize(); |
100 OS.objc_msgSend_stret(result, this.id, OS.sel_size); | 92 OS.objc_msgSend_stret(&result, this.id, OS.sel_size); |
101 return result; | 93 return result; |
102 } | 94 } |
103 | 95 |
104 } | 96 } |