Mercurial > projects > dstep
comparison dstep/appkit/NSImage.d @ 16:19885b43130e
Huge update, the bridge actually works now
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Sun, 03 Jan 2010 22:06:11 +0100 |
parents | |
children | f8a3b67adfcb |
comparison
equal
deleted
inserted
replaced
15:7ff919f595d5 | 16:19885b43130e |
---|---|
1 /** | |
2 * Copyright: Copyright (c) 2009 Jacob Carlborg. | |
3 * Authors: Jacob Carlborg | |
4 * Version: Initial created: Sep 24, 2009 | |
5 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) | |
6 */ | |
7 module dstep.appkit.NSImage; | |
8 | |
9 import dstep.appkit.NSBitmapImageRep; | |
10 import dstep.appkit.NSColor; | |
11 import dstep.appkit.NSGraphics; | |
12 import dstep.appkit.NSImageRep; | |
13 import dstep.appkit.NSPasteboard; | |
14 import dstep.applicationservices.ApplicationServices; | |
15 import dstep.foundation.NSArray; | |
16 import dstep.foundation.NSBundle; | |
17 import dstep.foundation.NSCoder; | |
18 import dstep.foundation.NSData; | |
19 import dstep.foundation.NSDictionary; | |
20 import dstep.foundation.NSGeometry; | |
21 import dstep.foundation.NSObjCRuntime; | |
22 import dstep.foundation.NSObject; | |
23 import dstep.foundation.NSString; | |
24 import dstep.foundation.NSURL; | |
25 import dstep.foundation.NSZone; | |
26 import dstep.objc.bridge.Bridge; | |
27 import dstep.objc.objc; | |
28 | |
29 import bindings = dstep.appkit.NSImage_bindings; | |
30 | |
31 typedef NSUInteger NSImageLoadStatus; | |
32 typedef NSUInteger NSImageCacheMode; | |
33 | |
34 private struct OpaqueIconRef; | |
35 alias OpaqueIconRef* IconRef; | |
36 | |
37 private | |
38 { | |
39 NSString NSImageNameQuickLookTemplate_; | |
40 NSString NSImageNameBluetoothTemplate_; | |
41 NSString NSImageNameIChatTheaterTemplate_; | |
42 NSString NSImageNameSlideshowTemplate_; | |
43 NSString NSImageNameActionTemplate_; | |
44 NSString NSImageNameSmartBadgeTemplate_; | |
45 NSString NSImageNameIconViewTemplate_; | |
46 NSString NSImageNameListViewTemplate_; | |
47 NSString NSImageNameColumnViewTemplate_; | |
48 NSString NSImageNameFlowViewTemplate_; | |
49 NSString NSImageNamePathTemplate_; | |
50 NSString NSImageNameInvalidDataFreestandingTemplate_; | |
51 NSString NSImageNameLockLockedTemplate_; | |
52 NSString NSImageNameLockUnlockedTemplate_; | |
53 NSString NSImageNameGoRightTemplate_; | |
54 NSString NSImageNameGoLeftTemplate_; | |
55 NSString NSImageNameRightFacingTriangleTemplate_; | |
56 NSString NSImageNameLeftFacingTriangleTemplate_; | |
57 NSString NSImageNameAddTemplate_; | |
58 NSString NSImageNameRemoveTemplate_; | |
59 NSString NSImageNameRevealFreestandingTemplate_; | |
60 NSString NSImageNameFollowLinkFreestandingTemplate_; | |
61 NSString NSImageNameEnterFullScreenTemplate_; | |
62 NSString NSImageNameExitFullScreenTemplate_; | |
63 NSString NSImageNameStopProgressTemplate_; | |
64 NSString NSImageNameStopProgressFreestandingTemplate_; | |
65 NSString NSImageNameRefreshTemplate_; | |
66 NSString NSImageNameRefreshFreestandingTemplate_; | |
67 NSString NSImageNameBonjour_; | |
68 NSString NSImageNameDotMac_; | |
69 NSString NSImageNameComputer_; | |
70 NSString NSImageNameFolderBurnable_; | |
71 NSString NSImageNameFolderSmart_; | |
72 NSString NSImageNameNetwork_; | |
73 NSString NSImageNameMultipleDocuments_; | |
74 NSString NSImageNameUserAccounts_; | |
75 NSString NSImageNamePreferencesGeneral_; | |
76 NSString NSImageNameAdvanced_; | |
77 NSString NSImageNameInfo_; | |
78 NSString NSImageNameFontPanel_; | |
79 NSString NSImageNameColorPanel_; | |
80 NSString NSImageNameUser_; | |
81 NSString NSImageNameUserGroup_; | |
82 NSString NSImageNameEveryone_; | |
83 } | |
84 | |
85 NSString NSImageNameQuickLookTemplate () | |
86 { | |
87 if (NSImageNameQuickLookTemplate_) | |
88 return NSImageNameQuickLookTemplate_; | |
89 | |
90 return NSImageNameQuickLookTemplate_ = new NSString(bindings.NSImageNameQuickLookTemplate); | |
91 } | |
92 | |
93 NSString NSImageNameBluetoothTemplate () | |
94 { | |
95 if (NSImageNameBluetoothTemplate_) | |
96 return NSImageNameBluetoothTemplate_; | |
97 | |
98 return NSImageNameBluetoothTemplate_ = new NSString(bindings.NSImageNameBluetoothTemplate); | |
99 } | |
100 | |
101 NSString NSImageNameIChatTheaterTemplate () | |
102 { | |
103 if (NSImageNameIChatTheaterTemplate_) | |
104 return NSImageNameIChatTheaterTemplate_; | |
105 | |
106 return NSImageNameIChatTheaterTemplate_ = new NSString(bindings.NSImageNameIChatTheaterTemplate); | |
107 } | |
108 | |
109 NSString NSImageNameSlideshowTemplate () | |
110 { | |
111 if (NSImageNameSlideshowTemplate_) | |
112 return NSImageNameSlideshowTemplate_; | |
113 | |
114 return NSImageNameSlideshowTemplate_ = new NSString(bindings.NSImageNameSlideshowTemplate); | |
115 } | |
116 | |
117 NSString NSImageNameActionTemplate () | |
118 { | |
119 if (NSImageNameActionTemplate_) | |
120 return NSImageNameActionTemplate_; | |
121 | |
122 return NSImageNameActionTemplate_ = new NSString(bindings.NSImageNameActionTemplate); | |
123 } | |
124 | |
125 NSString NSImageNameSmartBadgeTemplate () | |
126 { | |
127 if (NSImageNameSmartBadgeTemplate_) | |
128 return NSImageNameSmartBadgeTemplate_; | |
129 | |
130 return NSImageNameSmartBadgeTemplate_ = new NSString(bindings.NSImageNameSmartBadgeTemplate); | |
131 } | |
132 | |
133 NSString NSImageNameIconViewTemplate () | |
134 { | |
135 if (NSImageNameIconViewTemplate_) | |
136 return NSImageNameIconViewTemplate_; | |
137 | |
138 return NSImageNameIconViewTemplate_ = new NSString(bindings.NSImageNameIconViewTemplate); | |
139 } | |
140 | |
141 NSString NSImageNameListViewTemplate () | |
142 { | |
143 if (NSImageNameListViewTemplate_) | |
144 return NSImageNameListViewTemplate_; | |
145 | |
146 return NSImageNameListViewTemplate_ = new NSString(bindings.NSImageNameListViewTemplate); | |
147 } | |
148 | |
149 NSString NSImageNameColumnViewTemplate () | |
150 { | |
151 if (NSImageNameColumnViewTemplate_) | |
152 return NSImageNameColumnViewTemplate_; | |
153 | |
154 return NSImageNameColumnViewTemplate_ = new NSString(bindings.NSImageNameColumnViewTemplate); | |
155 } | |
156 | |
157 NSString NSImageNameFlowViewTemplate () | |
158 { | |
159 if (NSImageNameFlowViewTemplate_) | |
160 return NSImageNameFlowViewTemplate_; | |
161 | |
162 return NSImageNameFlowViewTemplate_ = new NSString(bindings.NSImageNameFlowViewTemplate); | |
163 } | |
164 | |
165 NSString NSImageNamePathTemplate () | |
166 { | |
167 if (NSImageNamePathTemplate_) | |
168 return NSImageNamePathTemplate_; | |
169 | |
170 return NSImageNamePathTemplate_ = new NSString(bindings.NSImageNamePathTemplate); | |
171 } | |
172 | |
173 NSString NSImageNameInvalidDataFreestandingTemplate () | |
174 { | |
175 if (NSImageNameInvalidDataFreestandingTemplate_) | |
176 return NSImageNameInvalidDataFreestandingTemplate_; | |
177 | |
178 return NSImageNameInvalidDataFreestandingTemplate_ = new NSString(bindings.NSImageNameInvalidDataFreestandingTemplate); | |
179 } | |
180 | |
181 NSString NSImageNameLockLockedTemplate () | |
182 { | |
183 if (NSImageNameLockLockedTemplate_) | |
184 return NSImageNameLockLockedTemplate_; | |
185 | |
186 return NSImageNameLockLockedTemplate_ = new NSString(bindings.NSImageNameLockLockedTemplate); | |
187 } | |
188 | |
189 NSString NSImageNameLockUnlockedTemplate () | |
190 { | |
191 if (NSImageNameLockUnlockedTemplate_) | |
192 return NSImageNameLockUnlockedTemplate_; | |
193 | |
194 return NSImageNameLockUnlockedTemplate_ = new NSString(bindings.NSImageNameLockUnlockedTemplate); | |
195 } | |
196 | |
197 NSString NSImageNameGoRightTemplate () | |
198 { | |
199 if (NSImageNameGoRightTemplate_) | |
200 return NSImageNameGoRightTemplate_; | |
201 | |
202 return NSImageNameGoRightTemplate_ = new NSString(bindings.NSImageNameGoRightTemplate); | |
203 } | |
204 | |
205 NSString NSImageNameGoLeftTemplate () | |
206 { | |
207 if (NSImageNameGoLeftTemplate_) | |
208 return NSImageNameGoLeftTemplate_; | |
209 | |
210 return NSImageNameGoLeftTemplate_ = new NSString(bindings.NSImageNameGoLeftTemplate); | |
211 } | |
212 | |
213 NSString NSImageNameRightFacingTriangleTemplate () | |
214 { | |
215 if (NSImageNameRightFacingTriangleTemplate_) | |
216 return NSImageNameRightFacingTriangleTemplate_; | |
217 | |
218 return NSImageNameRightFacingTriangleTemplate_ = new NSString(bindings.NSImageNameRightFacingTriangleTemplate); | |
219 } | |
220 | |
221 NSString NSImageNameLeftFacingTriangleTemplate () | |
222 { | |
223 if (NSImageNameLeftFacingTriangleTemplate_) | |
224 return NSImageNameLeftFacingTriangleTemplate_; | |
225 | |
226 return NSImageNameLeftFacingTriangleTemplate_ = new NSString(bindings.NSImageNameLeftFacingTriangleTemplate); | |
227 } | |
228 | |
229 NSString NSImageNameAddTemplate () | |
230 { | |
231 if (NSImageNameAddTemplate_) | |
232 return NSImageNameAddTemplate_; | |
233 | |
234 return NSImageNameAddTemplate_ = new NSString(bindings.NSImageNameAddTemplate); | |
235 } | |
236 | |
237 NSString NSImageNameRemoveTemplate () | |
238 { | |
239 if (NSImageNameRemoveTemplate_) | |
240 return NSImageNameRemoveTemplate_; | |
241 | |
242 return NSImageNameRemoveTemplate_ = new NSString(bindings.NSImageNameRemoveTemplate); | |
243 } | |
244 | |
245 NSString NSImageNameRevealFreestandingTemplate () | |
246 { | |
247 if (NSImageNameRevealFreestandingTemplate_) | |
248 return NSImageNameRevealFreestandingTemplate_; | |
249 | |
250 return NSImageNameRevealFreestandingTemplate_ = new NSString(bindings.NSImageNameRevealFreestandingTemplate); | |
251 } | |
252 | |
253 NSString NSImageNameFollowLinkFreestandingTemplate () | |
254 { | |
255 if (NSImageNameFollowLinkFreestandingTemplate_) | |
256 return NSImageNameFollowLinkFreestandingTemplate_; | |
257 | |
258 return NSImageNameFollowLinkFreestandingTemplate_ = new NSString(bindings.NSImageNameFollowLinkFreestandingTemplate); | |
259 } | |
260 | |
261 NSString NSImageNameEnterFullScreenTemplate () | |
262 { | |
263 if (NSImageNameEnterFullScreenTemplate_) | |
264 return NSImageNameEnterFullScreenTemplate_; | |
265 | |
266 return NSImageNameEnterFullScreenTemplate_ = new NSString(bindings.NSImageNameEnterFullScreenTemplate); | |
267 } | |
268 | |
269 NSString NSImageNameExitFullScreenTemplate () | |
270 { | |
271 if (NSImageNameExitFullScreenTemplate_) | |
272 return NSImageNameExitFullScreenTemplate_; | |
273 | |
274 return NSImageNameExitFullScreenTemplate_ = new NSString(bindings.NSImageNameExitFullScreenTemplate); | |
275 } | |
276 | |
277 NSString NSImageNameStopProgressTemplate () | |
278 { | |
279 if (NSImageNameStopProgressTemplate_) | |
280 return NSImageNameStopProgressTemplate_; | |
281 | |
282 return NSImageNameStopProgressTemplate_ = new NSString(bindings.NSImageNameStopProgressTemplate); | |
283 } | |
284 | |
285 NSString NSImageNameStopProgressFreestandingTemplate () | |
286 { | |
287 if (NSImageNameStopProgressFreestandingTemplate_) | |
288 return NSImageNameStopProgressFreestandingTemplate_; | |
289 | |
290 return NSImageNameStopProgressFreestandingTemplate_ = new NSString(bindings.NSImageNameStopProgressFreestandingTemplate); | |
291 } | |
292 | |
293 NSString NSImageNameRefreshTemplate () | |
294 { | |
295 if (NSImageNameRefreshTemplate_) | |
296 return NSImageNameRefreshTemplate_; | |
297 | |
298 return NSImageNameRefreshTemplate_ = new NSString(bindings.NSImageNameRefreshTemplate); | |
299 } | |
300 | |
301 NSString NSImageNameRefreshFreestandingTemplate () | |
302 { | |
303 if (NSImageNameRefreshFreestandingTemplate_) | |
304 return NSImageNameRefreshFreestandingTemplate_; | |
305 | |
306 return NSImageNameRefreshFreestandingTemplate_ = new NSString(bindings.NSImageNameRefreshFreestandingTemplate); | |
307 } | |
308 | |
309 NSString NSImageNameBonjour () | |
310 { | |
311 if (NSImageNameBonjour_) | |
312 return NSImageNameBonjour_; | |
313 | |
314 return NSImageNameBonjour_ = new NSString(bindings.NSImageNameBonjour); | |
315 } | |
316 | |
317 NSString NSImageNameDotMac () | |
318 { | |
319 if (NSImageNameDotMac_) | |
320 return NSImageNameDotMac_; | |
321 | |
322 return NSImageNameDotMac_ = new NSString(bindings.NSImageNameDotMac); | |
323 } | |
324 | |
325 NSString NSImageNameComputer () | |
326 { | |
327 if (NSImageNameComputer_) | |
328 return NSImageNameComputer_; | |
329 | |
330 return NSImageNameComputer_ = new NSString(bindings.NSImageNameComputer); | |
331 } | |
332 | |
333 NSString NSImageNameFolderBurnable () | |
334 { | |
335 if (NSImageNameFolderBurnable_) | |
336 return NSImageNameFolderBurnable_; | |
337 | |
338 return NSImageNameFolderBurnable_ = new NSString(bindings.NSImageNameFolderBurnable); | |
339 } | |
340 | |
341 NSString NSImageNameFolderSmart () | |
342 { | |
343 if (NSImageNameFolderSmart_) | |
344 return NSImageNameFolderSmart_; | |
345 | |
346 return NSImageNameFolderSmart_ = new NSString(bindings.NSImageNameFolderSmart); | |
347 } | |
348 | |
349 NSString NSImageNameNetwork () | |
350 { | |
351 if (NSImageNameNetwork_) | |
352 return NSImageNameNetwork_; | |
353 | |
354 return NSImageNameNetwork_ = new NSString(bindings.NSImageNameNetwork); | |
355 } | |
356 | |
357 NSString NSImageNameMultipleDocuments () | |
358 { | |
359 if (NSImageNameMultipleDocuments_) | |
360 return NSImageNameMultipleDocuments_; | |
361 | |
362 return NSImageNameMultipleDocuments_ = new NSString(bindings.NSImageNameMultipleDocuments); | |
363 } | |
364 | |
365 NSString NSImageNameUserAccounts () | |
366 { | |
367 if (NSImageNameUserAccounts_) | |
368 return NSImageNameUserAccounts_; | |
369 | |
370 return NSImageNameUserAccounts_ = new NSString(bindings.NSImageNameUserAccounts); | |
371 } | |
372 | |
373 NSString NSImageNamePreferencesGeneral () | |
374 { | |
375 if (NSImageNamePreferencesGeneral_) | |
376 return NSImageNamePreferencesGeneral_; | |
377 | |
378 return NSImageNamePreferencesGeneral_ = new NSString(bindings.NSImageNamePreferencesGeneral); | |
379 } | |
380 | |
381 NSString NSImageNameAdvanced () | |
382 { | |
383 if (NSImageNameAdvanced_) | |
384 return NSImageNameAdvanced_; | |
385 | |
386 return NSImageNameAdvanced_ = new NSString(bindings.NSImageNameAdvanced); | |
387 } | |
388 | |
389 NSString NSImageNameInfo () | |
390 { | |
391 if (NSImageNameInfo_) | |
392 return NSImageNameInfo_; | |
393 | |
394 return NSImageNameInfo_ = new NSString(bindings.NSImageNameInfo); | |
395 } | |
396 | |
397 NSString NSImageNameFontPanel () | |
398 { | |
399 if (NSImageNameFontPanel_) | |
400 return NSImageNameFontPanel_; | |
401 | |
402 return NSImageNameFontPanel_ = new NSString(bindings.NSImageNameFontPanel); | |
403 } | |
404 | |
405 NSString NSImageNameColorPanel () | |
406 { | |
407 if (NSImageNameColorPanel_) | |
408 return NSImageNameColorPanel_; | |
409 | |
410 return NSImageNameColorPanel_ = new NSString(bindings.NSImageNameColorPanel); | |
411 } | |
412 | |
413 NSString NSImageNameUser () | |
414 { | |
415 if (NSImageNameUser_) | |
416 return NSImageNameUser_; | |
417 | |
418 return NSImageNameUser_ = new NSString(bindings.NSImageNameUser); | |
419 } | |
420 | |
421 NSString NSImageNameUserGroup () | |
422 { | |
423 if (NSImageNameUserGroup_) | |
424 return NSImageNameUserGroup_; | |
425 | |
426 return NSImageNameUserGroup_ = new NSString(bindings.NSImageNameUserGroup); | |
427 } | |
428 | |
429 NSString NSImageNameEveryone () | |
430 { | |
431 if (NSImageNameEveryone_) | |
432 return NSImageNameEveryone_; | |
433 | |
434 return NSImageNameEveryone_ = new NSString(bindings.NSImageNameEveryone); | |
435 } | |
436 | |
437 enum | |
438 { | |
439 NSImageLoadStatusCompleted, | |
440 NSImageLoadStatusCancelled, | |
441 NSImageLoadStatusInvalidData, | |
442 NSImageLoadStatusUnexpectedEOF, | |
443 NSImageLoadStatusReadError | |
444 } | |
445 | |
446 enum | |
447 { | |
448 NSImageCacheDefault, | |
449 NSImageCacheAlways, | |
450 NSImageCacheBySize, | |
451 NSImageCacheNever | |
452 } | |
453 | |
454 class NSImage : NSObject, INSCopying, INSCoding | |
455 { | |
456 mixin (ObjcWrap); | |
457 | |
458 this (NSCoder aDecoder) | |
459 { | |
460 super(typeof(this).alloc.initWithCoder(aDecoder).objcObject); | |
461 } | |
462 | |
463 void encodeWithCoder (NSCoder aCoder) | |
464 { | |
465 return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); | |
466 } | |
467 | |
468 typeof(this) initWithCoder (NSCoder aDecoder) | |
469 { | |
470 return invokeObjcSelf!(typeof(this), "initWithCoder:", NSCoder)(aDecoder); | |
471 } | |
472 | |
473 typeof(this) copyWithZone (NSZone* zone) | |
474 { | |
475 return invokeObjcSelf!(typeof(this), "copyWithZone:", NSZone*)(zone); | |
476 } | |
477 | |
478 static Object imageNamed (NSString name) | |
479 { | |
480 return invokeObjcSelfClass!(Object, "imageNamed:", NSString)(name); | |
481 } | |
482 | |
483 NSImage initWithSize (NSSize aSize) | |
484 { | |
485 id result = invokeObjcSelf!(id, "initWithSize:", NSSize)(aSize); | |
486 return result is this.objcObject ? this : (result !is null ? new NSImage(result) : null); | |
487 } | |
488 | |
489 this (NSSize aSize) | |
490 { | |
491 super(NSImage.alloc.initWithSize(aSize).objcObject); | |
492 } | |
493 | |
494 NSImage initWithData (NSData data) | |
495 { | |
496 id result = invokeObjcSelf!(id, "initWithData:", NSData)(data); | |
497 return result is this.objcObject ? this : (result !is null ? new NSImage(result) : null); | |
498 } | |
499 | |
500 this (NSData data) | |
501 { | |
502 super(NSImage.alloc.initWithData(data).objcObject); | |
503 } | |
504 | |
505 NSImage initWithContentsOfFile (NSString fileName) | |
506 { | |
507 id result = invokeObjcSelf!(id, "initWithContentsOfFile:", NSString)(fileName); | |
508 return result is this.objcObject ? this : (result !is null ? new NSImage(result) : null); | |
509 } | |
510 | |
511 this (NSString fileName) | |
512 { | |
513 super(NSImage.alloc.initWithContentsOfFile(fileName).objcObject); | |
514 } | |
515 | |
516 NSImage initWithContentsOfURL (NSURL url) | |
517 { | |
518 id result = invokeObjcSelf!(id, "initWithContentsOfURL:", NSURL)(url); | |
519 return result is this.objcObject ? this : (result !is null ? new NSImage(result) : null); | |
520 } | |
521 | |
522 this (NSURL url) | |
523 { | |
524 super(NSImage.alloc.initWithContentsOfURL(url).objcObject); | |
525 } | |
526 | |
527 NSImage initByReferencingFile (NSString fileName) | |
528 { | |
529 id result = invokeObjcSelf!(id, "initByReferencingFile:", NSString)(fileName); | |
530 return result is this.objcObject ? this : (result !is null ? new NSImage(result) : null); | |
531 } | |
532 | |
533 this (NSString fileName) | |
534 { | |
535 super(NSImage.alloc.initByReferencingFile(fileName).objcObject); | |
536 } | |
537 | |
538 NSImage initByReferencingURL (NSURL url) | |
539 { | |
540 id result = invokeObjcSelf!(id, "initByReferencingURL:", NSURL)(url); | |
541 return result is this.objcObject ? this : (result !is null ? new NSImage(result) : null); | |
542 } | |
543 | |
544 this (NSURL url) | |
545 { | |
546 super(NSImage.alloc.initByReferencingURL(url).objcObject); | |
547 } | |
548 | |
549 NSImage initWithIconRef (IconRef iconRef) | |
550 { | |
551 id result = invokeObjcSelf!(id, "initWithIconRef:", IconRef)(iconRef); | |
552 return result is this.objcObject ? this : (result !is null ? new NSImage(result) : null); | |
553 } | |
554 | |
555 this (IconRef iconRef) | |
556 { | |
557 super(NSImage.alloc.initWithIconRef(iconRef).objcObject); | |
558 } | |
559 | |
560 NSImage initWithPasteboard (NSPasteboard pasteboard) | |
561 { | |
562 id result = invokeObjcSelf!(id, "initWithPasteboard:", NSPasteboard)(pasteboard); | |
563 return result is this.objcObject ? this : (result !is null ? new NSImage(result) : null); | |
564 } | |
565 | |
566 this (NSPasteboard pasteboard) | |
567 { | |
568 super(NSImage.alloc.initWithPasteboard(pasteboard).objcObject); | |
569 } | |
570 | |
571 void setSize (NSSize aSize) | |
572 { | |
573 return invokeObjcSelf!(void, "setSize:", NSSize)(aSize); | |
574 } | |
575 | |
576 NSSize size () | |
577 { | |
578 return invokeObjcSelf!(NSSize, "size"); | |
579 } | |
580 | |
581 bool setName (NSString string) | |
582 { | |
583 return invokeObjcSelf!(bool, "setName:", NSString)(string); | |
584 } | |
585 | |
586 NSString name () | |
587 { | |
588 return invokeObjcSelf!(NSString, "name"); | |
589 } | |
590 | |
591 void setScalesWhenResized (bool flag) | |
592 { | |
593 return invokeObjcSelf!(void, "setScalesWhenResized:", bool)(flag); | |
594 } | |
595 | |
596 bool scalesWhenResized () | |
597 { | |
598 return invokeObjcSelf!(bool, "scalesWhenResized"); | |
599 } | |
600 | |
601 void setDataRetained (bool flag) | |
602 { | |
603 return invokeObjcSelf!(void, "setDataRetained:", bool)(flag); | |
604 } | |
605 | |
606 bool isDataRetained () | |
607 { | |
608 return invokeObjcSelf!(bool, "isDataRetained"); | |
609 } | |
610 | |
611 void setCachedSeparately (bool flag) | |
612 { | |
613 return invokeObjcSelf!(void, "setCachedSeparately:", bool)(flag); | |
614 } | |
615 | |
616 bool isCachedSeparately () | |
617 { | |
618 return invokeObjcSelf!(bool, "isCachedSeparately"); | |
619 } | |
620 | |
621 void setCacheDepthMatchesImageDepth (bool flag) | |
622 { | |
623 return invokeObjcSelf!(void, "setCacheDepthMatchesImageDepth:", bool)(flag); | |
624 } | |
625 | |
626 bool cacheDepthMatchesImageDepth () | |
627 { | |
628 return invokeObjcSelf!(bool, "cacheDepthMatchesImageDepth"); | |
629 } | |
630 | |
631 void setBackgroundColor (NSColor aColor) | |
632 { | |
633 return invokeObjcSelf!(void, "setBackgroundColor:", NSColor)(aColor); | |
634 } | |
635 | |
636 NSColor backgroundColor () | |
637 { | |
638 return invokeObjcSelf!(NSColor, "backgroundColor"); | |
639 } | |
640 | |
641 void setUsesEPSOnResolutionMismatch (bool flag) | |
642 { | |
643 return invokeObjcSelf!(void, "setUsesEPSOnResolutionMismatch:", bool)(flag); | |
644 } | |
645 | |
646 bool usesEPSOnResolutionMismatch () | |
647 { | |
648 return invokeObjcSelf!(bool, "usesEPSOnResolutionMismatch"); | |
649 } | |
650 | |
651 void setPrefersColorMatch (bool flag) | |
652 { | |
653 return invokeObjcSelf!(void, "setPrefersColorMatch:", bool)(flag); | |
654 } | |
655 | |
656 bool prefersColorMatch () | |
657 { | |
658 return invokeObjcSelf!(bool, "prefersColorMatch"); | |
659 } | |
660 | |
661 void setMatchesOnMultipleResolution (bool flag) | |
662 { | |
663 return invokeObjcSelf!(void, "setMatchesOnMultipleResolution:", bool)(flag); | |
664 } | |
665 | |
666 bool matchesOnMultipleResolution () | |
667 { | |
668 return invokeObjcSelf!(bool, "matchesOnMultipleResolution"); | |
669 } | |
670 | |
671 void dissolveToPoint (NSPoint point, CGFloat aFloat) | |
672 { | |
673 return invokeObjcSelf!(void, "dissolveToPoint:fraction:", NSPoint, CGFloat)(point, aFloat); | |
674 } | |
675 | |
676 void dissolveToPoint (NSPoint point, NSRect rect, CGFloat aFloat) | |
677 { | |
678 return invokeObjcSelf!(void, "dissolveToPoint:fromRect:fraction:", NSPoint, NSRect, CGFloat)(point, rect, aFloat); | |
679 } | |
680 | |
681 void compositeToPoint (NSPoint point, uint op) | |
682 { | |
683 return invokeObjcSelf!(void, "compositeToPoint:operation:", NSPoint, uint)(point, op); | |
684 } | |
685 | |
686 void compositeToPoint (NSPoint point, NSRect rect, uint op) | |
687 { | |
688 return invokeObjcSelf!(void, "compositeToPoint:fromRect:operation:", NSPoint, NSRect, uint)(point, rect, op); | |
689 } | |
690 | |
691 void compositeToPoint (NSPoint point, uint op, CGFloat delta) | |
692 { | |
693 return invokeObjcSelf!(void, "compositeToPoint:operation:fraction:", NSPoint, uint, CGFloat)(point, op, delta); | |
694 } | |
695 | |
696 void compositeToPoint (NSPoint point, NSRect rect, uint op, CGFloat delta) | |
697 { | |
698 return invokeObjcSelf!(void, "compositeToPoint:fromRect:operation:fraction:", NSPoint, NSRect, uint, CGFloat)(point, rect, op, delta); | |
699 } | |
700 | |
701 void drawAtPoint (NSPoint point, NSRect fromRect, uint op, CGFloat delta) | |
702 { | |
703 return invokeObjcSelf!(void, "drawAtPoint:fromRect:operation:fraction:", NSPoint, NSRect, uint, CGFloat)(point, fromRect, op, delta); | |
704 } | |
705 | |
706 void drawInRect (NSRect rect, NSRect fromRect, uint op, CGFloat delta) | |
707 { | |
708 return invokeObjcSelf!(void, "drawInRect:fromRect:operation:fraction:", NSRect, NSRect, uint, CGFloat)(rect, fromRect, op, delta); | |
709 } | |
710 | |
711 bool drawRepresentation (NSImageRep imageRep, NSRect rect) | |
712 { | |
713 return invokeObjcSelf!(bool, "drawRepresentation:inRect:", NSImageRep, NSRect)(imageRep, rect); | |
714 } | |
715 | |
716 void recache () | |
717 { | |
718 return invokeObjcSelf!(void, "recache"); | |
719 } | |
720 | |
721 NSData TIFFRepresentation () | |
722 { | |
723 return invokeObjcSelf!(NSData, "TIFFRepresentation"); | |
724 } | |
725 | |
726 NSData TIFFRepresentationUsingCompression (uint comp, float aFloat) | |
727 { | |
728 return invokeObjcSelf!(NSData, "TIFFRepresentationUsingCompression:factor:", uint, float)(comp, aFloat); | |
729 } | |
730 | |
731 NSArray representations () | |
732 { | |
733 return invokeObjcSelf!(NSArray, "representations"); | |
734 } | |
735 | |
736 void addRepresentations (NSArray imageReps) | |
737 { | |
738 return invokeObjcSelf!(void, "addRepresentations:", NSArray)(imageReps); | |
739 } | |
740 | |
741 void addRepresentation (NSImageRep imageRep) | |
742 { | |
743 return invokeObjcSelf!(void, "addRepresentation:", NSImageRep)(imageRep); | |
744 } | |
745 | |
746 void removeRepresentation (NSImageRep imageRep) | |
747 { | |
748 return invokeObjcSelf!(void, "removeRepresentation:", NSImageRep)(imageRep); | |
749 } | |
750 | |
751 bool isValid () | |
752 { | |
753 return invokeObjcSelf!(bool, "isValid"); | |
754 } | |
755 | |
756 void lockFocus () | |
757 { | |
758 return invokeObjcSelf!(void, "lockFocus"); | |
759 } | |
760 | |
761 void lockFocusOnRepresentation (NSImageRep imageRepresentation) | |
762 { | |
763 return invokeObjcSelf!(void, "lockFocusOnRepresentation:", NSImageRep)(imageRepresentation); | |
764 } | |
765 | |
766 void unlockFocus () | |
767 { | |
768 return invokeObjcSelf!(void, "unlockFocus"); | |
769 } | |
770 | |
771 NSImageRep bestRepresentationForDevice (NSDictionary deviceDescription) | |
772 { | |
773 return invokeObjcSelf!(NSImageRep, "bestRepresentationForDevice:", NSDictionary)(deviceDescription); | |
774 } | |
775 | |
776 void setDelegate (Object anObject) | |
777 { | |
778 return invokeObjcSelf!(void, "setDelegate:", Object)(anObject); | |
779 } | |
780 | |
781 Object delegate_ () | |
782 { | |
783 return invokeObjcSelf!(Object, "delegate"); | |
784 } | |
785 | |
786 static NSArray imageUnfilteredFileTypes () | |
787 { | |
788 return invokeObjcSelfClass!(NSArray, "imageUnfilteredFileTypes"); | |
789 } | |
790 | |
791 static NSArray imageUnfilteredPasteboardTypes () | |
792 { | |
793 return invokeObjcSelfClass!(NSArray, "imageUnfilteredPasteboardTypes"); | |
794 } | |
795 | |
796 static NSArray imageFileTypes () | |
797 { | |
798 return invokeObjcSelfClass!(NSArray, "imageFileTypes"); | |
799 } | |
800 | |
801 static NSArray imagePasteboardTypes () | |
802 { | |
803 return invokeObjcSelfClass!(NSArray, "imagePasteboardTypes"); | |
804 } | |
805 | |
806 static NSArray imageTypes () | |
807 { | |
808 return invokeObjcSelfClass!(NSArray, "imageTypes"); | |
809 } | |
810 | |
811 static NSArray imageUnfilteredTypes () | |
812 { | |
813 return invokeObjcSelfClass!(NSArray, "imageUnfilteredTypes"); | |
814 } | |
815 | |
816 static bool canInitWithPasteboard (NSPasteboard pasteboard) | |
817 { | |
818 return invokeObjcSelfClass!(bool, "canInitWithPasteboard:", NSPasteboard)(pasteboard); | |
819 } | |
820 | |
821 void setFlipped (bool flag) | |
822 { | |
823 return invokeObjcSelf!(void, "setFlipped:", bool)(flag); | |
824 } | |
825 | |
826 bool isFlipped () | |
827 { | |
828 return invokeObjcSelf!(bool, "isFlipped"); | |
829 } | |
830 | |
831 void cancelIncrementalLoad () | |
832 { | |
833 return invokeObjcSelf!(void, "cancelIncrementalLoad"); | |
834 } | |
835 | |
836 void setCacheMode (uint mode) | |
837 { | |
838 return invokeObjcSelf!(void, "setCacheMode:", uint)(mode); | |
839 } | |
840 | |
841 uint cacheMode () | |
842 { | |
843 return invokeObjcSelf!(uint, "cacheMode"); | |
844 } | |
845 | |
846 NSRect alignmentRect () | |
847 { | |
848 return invokeObjcSelf!(NSRect, "alignmentRect"); | |
849 } | |
850 | |
851 void setAlignmentRect (NSRect rect) | |
852 { | |
853 return invokeObjcSelf!(void, "setAlignmentRect:", NSRect)(rect); | |
854 } | |
855 | |
856 bool isTemplate () | |
857 { | |
858 return invokeObjcSelf!(bool, "isTemplate"); | |
859 } | |
860 | |
861 void setTemplate (bool isTemplate) | |
862 { | |
863 return invokeObjcSelf!(void, "setTemplate:", bool)(isTemplate); | |
864 } | |
865 | |
866 } | |
867 | |
868 const TNSImageDelegate = ` | |
869 | |
870 NSImage imageDidNotDraw (Object sender, NSRect aRect) | |
871 { | |
872 return invokeObjcSelf!(NSImage, "imageDidNotDraw:inRect:", Object, NSRect)(sender, aRect); | |
873 } | |
874 | |
875 void image (NSImage image, NSImageRep rep) | |
876 { | |
877 return invokeObjcSelf!(void, "image:willLoadRepresentation:", NSImage, NSImageRep)(image, rep); | |
878 } | |
879 | |
880 void image (NSImage image, NSImageRep rep) | |
881 { | |
882 return invokeObjcSelf!(void, "image:didLoadRepresentationHeader:", NSImage, NSImageRep)(image, rep); | |
883 } | |
884 | |
885 void image (NSImage image, NSImageRep rep, NSInteger rows) | |
886 { | |
887 return invokeObjcSelf!(void, "image:didLoadPartOfRepresentation:withValidRows:", NSImage, NSImageRep, NSInteger)(image, rep, rows); | |
888 } | |
889 | |
890 void image (NSImage image, NSImageRep rep, uint status) | |
891 { | |
892 return invokeObjcSelf!(void, "image:didLoadRepresentation:withStatus:", NSImage, NSImageRep, uint)(image, rep, status); | |
893 } | |
894 | |
895 //mixin ObjcBindMethod!(imageDidNotDraw, "imageDidNotDraw:inRect:"); | |
896 //mixin ObjcBindMethod!(image, "image:willLoadRepresentation:"); | |
897 //mixin ObjcBindMethod!(image, "image:didLoadRepresentationHeader:"); | |
898 //mixin ObjcBindMethod!(image, "image:didLoadPartOfRepresentation:withValidRows:"); | |
899 //mixin ObjcBindMethod!(image, "image:didLoadRepresentation:withStatus:"); | |
900 | |
901 `; | |
902 | |
903 const TNSBundleImageExtension = ` | |
904 | |
905 NSString pathForImageResource (NSString name) | |
906 { | |
907 return invokeObjcSelf!(NSString, "pathForImageResource:", NSString)(name); | |
908 } | |
909 | |
910 //mixin ObjcBindMethod!(pathForImageResource, "pathForImageResource:"); | |
911 | |
912 `; | |
913 |