comparison dstep/appkit/NSDocument.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.NSDocument;
8
9 import dstep.appkit.NSDocumentScripting;
10 import dstep.appkit.NSFileWrapper;
11 import dstep.appkit.NSMenuItem;
12 import dstep.appkit.NSNibDeclarations;
13 import dstep.appkit.NSPageLayout;
14 import dstep.appkit.NSPrintInfo;
15 import dstep.appkit.NSPrintOperation;
16 import dstep.appkit.NSSavePanel;
17 import dstep.appkit.NSUserInterfaceValidation;
18 import dstep.appkit.NSView;
19 import dstep.appkit.NSWindow;
20 import dstep.appkit.NSWindowController;
21 import dstep.foundation.NSArray;
22 import dstep.foundation.NSData;
23 import dstep.foundation.NSDate;
24 import dstep.foundation.NSDictionary;
25 import dstep.foundation.NSError;
26 import dstep.foundation.NSObjCRuntime;
27 import dstep.foundation.NSObject;
28 import dstep.foundation.NSScriptCommand;
29 import dstep.foundation.NSScriptObjectSpecifiers;
30 import dstep.foundation.NSScriptStandardSuiteCommands;
31 import dstep.foundation.NSString;
32 import dstep.foundation.NSUndoManager;
33 import dstep.foundation.NSURL;
34 import dstep.objc.bridge.Bridge;
35 import dstep.objc.objc;
36
37 alias NSUInteger NSDocumentChangeType;
38 alias NSUInteger NSSaveOperationType;
39
40 enum
41 {
42 NSChangeDone = 0,
43 NSChangeUndone = 1,
44 NSChangeCleared = 2,
45 NSChangeRedone = 5,
46 NSChangeReadOtherContents = 3,
47 NSChangeAutosaved = 4
48 }
49
50 enum
51 {
52 NSSaveOperation = 0,
53 NSSaveAsOperation = 1,
54 NSSaveToOperation = 2,
55 NSAutosaveOperation = 3
56 }
57
58 const TNSDeprecated = `
59
60 NSData dataRepresentationOfType (NSString type)
61 {
62 return invokeObjcSelf!(NSData, "dataRepresentationOfType:", NSString)(type);
63 }
64
65 NSDictionary fileAttributesToWriteToFile (NSString fullDocumentPath, NSString documentTypeName, uint saveOperationType)
66 {
67 return invokeObjcSelf!(NSDictionary, "fileAttributesToWriteToFile:ofType:saveOperation:", NSString, NSString, uint)(fullDocumentPath, documentTypeName, saveOperationType);
68 }
69
70 NSString fileName ()
71 {
72 return invokeObjcSelf!(NSString, "fileName");
73 }
74
75 NSFileWrapper fileWrapperRepresentationOfType (NSString type)
76 {
77 return invokeObjcSelf!(NSFileWrapper, "fileWrapperRepresentationOfType:", NSString)(type);
78 }
79
80 typeof(this) initWithContentsOfFile (NSString absolutePath, NSString typeName)
81 {
82 id result = invokeObjcSelf!(id, "initWithContentsOfFile:ofType:", NSString, NSString)(absolutePath, typeName);
83 return result is this.objcObject ? this : (result !is null ? new typeof(this)(result) : null);
84 }
85
86 this (NSString absolutePath, NSString typeName)
87 {
88 super(typeof(this).alloc.initWithContentsOfFile(absolutePath, typeName).objcObject);
89 }
90
91 typeof(this) initWithContentsOfURL (NSURL absoluteURL, NSString typeName)
92 {
93 id result = invokeObjcSelf!(id, "initWithContentsOfURL:ofType:", NSURL, NSString)(absoluteURL, typeName);
94 return result is this.objcObject ? this : (result !is null ? new typeof(this)(result) : null);
95 }
96
97 this (NSURL absoluteURL, NSString typeName)
98 {
99 super(typeof(this).alloc.initWithContentsOfURL(absoluteURL, typeName).objcObject);
100 }
101
102 bool loadDataRepresentation (NSData data, NSString type)
103 {
104 return invokeObjcSelf!(bool, "loadDataRepresentation:ofType:", NSData, NSString)(data, type);
105 }
106
107 bool loadFileWrapperRepresentation (NSFileWrapper wrapper, NSString type)
108 {
109 return invokeObjcSelf!(bool, "loadFileWrapperRepresentation:ofType:", NSFileWrapper, NSString)(wrapper, type);
110 }
111
112 void printShowingPrintPanel (bool flag)
113 {
114 return invokeObjcSelf!(void, "printShowingPrintPanel:", bool)(flag);
115 }
116
117 bool readFromFile (NSString fileName, NSString type)
118 {
119 return invokeObjcSelf!(bool, "readFromFile:ofType:", NSString, NSString)(fileName, type);
120 }
121
122 bool readFromURL (NSURL url, NSString type)
123 {
124 return invokeObjcSelf!(bool, "readFromURL:ofType:", NSURL, NSString)(url, type);
125 }
126
127 bool revertToSavedFromFile (NSString fileName, NSString type)
128 {
129 return invokeObjcSelf!(bool, "revertToSavedFromFile:ofType:", NSString, NSString)(fileName, type);
130 }
131
132 bool revertToSavedFromURL (NSURL url, NSString type)
133 {
134 return invokeObjcSelf!(bool, "revertToSavedFromURL:ofType:", NSURL, NSString)(url, type);
135 }
136
137 NSInteger runModalPageLayoutWithPrintInfo (NSPrintInfo printInfo)
138 {
139 return invokeObjcSelf!(NSInteger, "runModalPageLayoutWithPrintInfo:", NSPrintInfo)(printInfo);
140 }
141
142 void saveToFile (NSString fileName, uint saveOperation, Object delegate_, SEL didSaveSelector, void* contextInfo)
143 {
144 return invokeObjcSelf!(void, "saveToFile:saveOperation:delegate:didSaveSelector:contextInfo:", NSString, uint, Object, SEL, void*)(fileName, saveOperation, delegate_, didSaveSelector, contextInfo);
145 }
146
147 void setFileName (NSString fileName)
148 {
149 return invokeObjcSelf!(void, "setFileName:", NSString)(fileName);
150 }
151
152 bool writeToFile (NSString fileName, NSString type)
153 {
154 return invokeObjcSelf!(bool, "writeToFile:ofType:", NSString, NSString)(fileName, type);
155 }
156
157 bool writeToFile (NSString fullDocumentPath, NSString documentTypeName, NSString fullOriginalDocumentPath, uint saveOperationType)
158 {
159 return invokeObjcSelf!(bool, "writeToFile:ofType:originalFile:saveOperation:", NSString, NSString, NSString, uint)(fullDocumentPath, documentTypeName, fullOriginalDocumentPath, saveOperationType);
160 }
161
162 bool writeToURL (NSURL url, NSString type)
163 {
164 return invokeObjcSelf!(bool, "writeToURL:ofType:", NSURL, NSString)(url, type);
165 }
166
167 bool writeWithBackupToFile (NSString fullDocumentPath, NSString documentTypeName, uint saveOperationType)
168 {
169 return invokeObjcSelf!(bool, "writeWithBackupToFile:ofType:saveOperation:", NSString, NSString, uint)(fullDocumentPath, documentTypeName, saveOperationType);
170 }
171
172 //mixin ObjcBindMethod!(dataRepresentationOfType, "dataRepresentationOfType:");
173 //mixin ObjcBindMethod!(fileAttributesToWriteToFile, "fileAttributesToWriteToFile:ofType:saveOperation:");
174 //mixin ObjcBindMethod!(fileName, "fileName");
175 //mixin ObjcBindMethod!(fileWrapperRepresentationOfType, "fileWrapperRepresentationOfType:");
176 //mixin ObjcBindMethod!(initWithContentsOfFile, "initWithContentsOfFile:ofType:");
177 //mixin ObjcBindMethod!(initWithContentsOfURL, "initWithContentsOfURL:ofType:");
178 //mixin ObjcBindMethod!(loadDataRepresentation, "loadDataRepresentation:ofType:");
179 //mixin ObjcBindMethod!(loadFileWrapperRepresentation, "loadFileWrapperRepresentation:ofType:");
180 //mixin ObjcBindMethod!(printShowingPrintPanel, "printShowingPrintPanel:");
181 //mixin ObjcBindMethod!(readFromFile, "readFromFile:ofType:");
182 ////mixin ObjcBindMethod!(readFromURL, "readFromURL:ofType:");
183 //mixin ObjcBindMethod!(revertToSavedFromFile, "revertToSavedFromFile:ofType:");
184 //mixin ObjcBindMethod!(revertToSavedFromURL, "revertToSavedFromURL:ofType:");
185 //mixin ObjcBindMethod!(runModalPageLayoutWithPrintInfo, "runModalPageLayoutWithPrintInfo:");
186 //mixin ObjcBindMethod!(saveToFile, "saveToFile:saveOperation:delegate:didSaveSelector:contextInfo:");
187 //mixin ObjcBindMethod!(setFileName, "setFileName:");
188 //mixin ObjcBindMethod!(writeToFile, "writeToFile:ofType:");
189 //mixin ObjcBindMethod!(writeToFile, "writeToFile:ofType:originalFile:saveOperation:");
190 ////mixin ObjcBindMethod!(writeToURL, "writeToURL:ofType:");
191 //mixin ObjcBindMethod!(writeWithBackupToFile, "writeWithBackupToFile:ofType:saveOperation:");
192
193 `;
194
195 class NSDocument : NSObject, INSUserInterfaceValidations
196 {
197 mixin (ObjcWrap);
198
199 NSDocument init ()
200 {
201 id result = invokeObjcSelf!(id, "init");
202 return result is this.objcObject ? this : (result !is null ? new NSDocument(result) : null);
203 }
204
205 this ()
206 {
207 super(NSDocument.alloc.init.objcObject);
208 }
209
210 NSDocument initWithType (NSString typeName, ref NSError outError)
211 {
212 id error;
213
214 if (outError)
215 error = new objc_object;
216
217 id result = invokeObjcSelf!(id, "initWithType:error:", NSString, id*)(typeName, &error);
218
219 if (error)
220 outError = new NSError(error);
221
222 return result is this.objcObject ? this : (result !is null ? new NSDocument(result) : null);
223 }
224
225 this (NSString typeName, ref NSError outError)
226 {
227 super(NSDocument.alloc.initWithType(typeName, outError).objcObject);
228 }
229
230 NSDocument initForURL (NSURL absoluteDocumentURL, NSURL absoluteDocumentContentsURL, NSString typeName, ref NSError outError)
231 {
232 id error;
233
234 if (outError)
235 error = new objc_object;
236
237 id result = invokeObjcSelf!(id, "initForURL:withContentsOfURL:ofType:error:", NSURL, NSURL, NSString, id*)(absoluteDocumentURL, absoluteDocumentContentsURL, typeName, &error);
238
239 if (error)
240 outError = new NSError(error);
241
242 return result is this.objcObject ? this : (result !is null ? new NSDocument(result) : null);
243 }
244
245 this (NSURL absoluteDocumentURL, NSURL absoluteDocumentContentsURL, NSString typeName, ref NSError outError)
246 {
247 super(NSDocument.alloc.initForURL(absoluteDocumentURL, absoluteDocumentContentsURL, typeName, outError).objcObject);
248 }
249
250 void setFileType (NSString typeName)
251 {
252 return invokeObjcSelf!(void, "setFileType:", NSString)(typeName);
253 }
254
255 NSString fileType ()
256 {
257 return invokeObjcSelf!(NSString, "fileType");
258 }
259
260 void setFileURL (NSURL absoluteURL)
261 {
262 return invokeObjcSelf!(void, "setFileURL:", NSURL)(absoluteURL);
263 }
264
265 NSURL fileURL ()
266 {
267 return invokeObjcSelf!(NSURL, "fileURL");
268 }
269
270 void setFileModificationDate (NSDate modificationDate)
271 {
272 return invokeObjcSelf!(void, "setFileModificationDate:", NSDate)(modificationDate);
273 }
274
275 NSDate fileModificationDate ()
276 {
277 return invokeObjcSelf!(NSDate, "fileModificationDate");
278 }
279
280 void revertDocumentToSaved (Object sender)
281 {
282 return invokeObjcSelf!(void, "revertDocumentToSaved:", Object)(sender);
283 }
284
285 bool revertToContentsOfURL (NSURL absoluteURL, NSString typeName, ref NSError outError)
286 {
287 id error;
288
289 if (outError)
290 error = new objc_object;
291
292 bool result = invokeObjcSelf!(bool, "revertToContentsOfURL:ofType:error:", NSURL, NSString, id*)(absoluteURL, typeName, &error);
293
294 if (error)
295 outError = new NSError(error);
296
297 return result;
298 }
299
300 bool readFromURL (NSURL absoluteURL, NSString typeName, ref NSError outError)
301 {
302 id error;
303
304 if (outError)
305 error = outError.objcObject;
306
307 bool result = invokeObjcSelf!(bool, "readFromURL:ofType:error:", NSURL, NSString, id*)(absoluteURL, typeName, &error);
308
309 if (error)
310 outError = new NSError(error);
311
312 return result;
313 }
314
315 bool readFromFileWrapper (NSFileWrapper fileWrapper, NSString typeName, ref NSError outError)
316 {
317 id error;
318
319 if (outError)
320 error = new objc_object;
321
322 bool result = invokeObjcSelf!(bool, "readFromFileWrapper:ofType:error:", NSFileWrapper, NSString, id*)(fileWrapper, typeName, &error);
323
324 if (error)
325 outError = new NSError(error);
326
327 return result;
328 }
329
330 bool readFromData (NSData data, NSString typeName, ref NSError outError)
331 {
332 id error;
333
334 if (outError)
335 error = new objc_object;
336
337 bool result = invokeObjcSelf!(bool, "readFromData:ofType:error:", NSData, NSString, id*)(data, typeName, &error);
338
339 if (error)
340 outError = new NSError(error);
341
342 return result;
343 }
344
345 bool writeToURL (NSURL absoluteURL, NSString typeName, ref NSError outError)
346 {
347 id error;
348
349 if (outError)
350 error = new objc_object;
351
352 bool result = invokeObjcSelf!(bool, "writeToURL:ofType:error:", NSURL, NSString, id*)(absoluteURL, typeName, &error);
353
354 if (error)
355 outError = new NSError(error);
356
357 return result;
358 }
359
360 NSFileWrapper fileWrapperOfType (NSString typeName, ref NSError outError)
361 {
362 id error;
363
364 if (outError)
365 error = new objc_object;
366
367 NSFileWrapper result = invokeObjcSelf!(NSFileWrapper, "fileWrapperOfType:error:", NSString, id*)(typeName, &error);
368
369 if (error)
370 outError = new NSError(error);
371
372 return result;
373 }
374
375 NSData dataOfType (NSString typeName, ref NSError outError)
376 {
377 id error;
378
379 if (outError)
380 error = new objc_object;
381
382 NSData result = invokeObjcSelf!(NSData, "dataOfType:error:", NSString, id*)(typeName, &error);
383
384 if (error)
385 outError = new NSError(error);
386
387 return result;
388 }
389
390 bool writeSafelyToURL (NSURL absoluteURL, NSString typeName, uint saveOperation, ref NSError outError)
391 {
392 id error;
393
394 if (outError)
395 error = new objc_object;
396
397 bool result = invokeObjcSelf!(bool, "writeSafelyToURL:ofType:forSaveOperation:error:", NSURL, NSString, uint, id*)(absoluteURL, typeName, saveOperation, &error);
398
399 if (error)
400 outError = new NSError(error);
401
402 return result;
403 }
404
405 bool writeToURL (NSURL absoluteURL, NSString typeName, uint saveOperation, NSURL absoluteOriginalContentsURL, ref NSError outError)
406 {
407 id error;
408
409 if (outError)
410 error = new objc_object;
411
412 bool result = invokeObjcSelf!(bool, "writeToURL:ofType:forSaveOperation:originalContentsURL:error:", NSURL, NSString, uint, NSURL, id*)(absoluteURL, typeName, saveOperation, absoluteOriginalContentsURL, &error);
413
414 if (error)
415 outError = new NSError(error);
416
417 return result;
418 }
419
420 NSDictionary fileAttributesToWriteToURL (NSURL absoluteURL, NSString typeName, uint saveOperation, NSURL absoluteOriginalContentsURL, ref NSError outError)
421 {
422 id error;
423
424 if (outError)
425 error = new objc_object;
426
427 NSDictionary result = invokeObjcSelf!(NSDictionary, "fileAttributesToWriteToURL:ofType:forSaveOperation:originalContentsURL:error:", NSURL, NSString, uint, NSURL, id*)(absoluteURL, typeName, saveOperation, absoluteOriginalContentsURL, &error);
428
429 if (error)
430 outError = new NSError(error);
431
432 return result;
433 }
434
435 bool keepBackupFile ()
436 {
437 return invokeObjcSelf!(bool, "keepBackupFile");
438 }
439
440 void saveDocument (Object sender)
441 {
442 return invokeObjcSelf!(void, "saveDocument:", Object)(sender);
443 }
444
445 void saveDocumentAs (Object sender)
446 {
447 return invokeObjcSelf!(void, "saveDocumentAs:", Object)(sender);
448 }
449
450 void saveDocumentTo (Object sender)
451 {
452 return invokeObjcSelf!(void, "saveDocumentTo:", Object)(sender);
453 }
454
455 void saveDocumentWithDelegate (Object delegate_, SEL didSaveSelector, void* contextInfo)
456 {
457 return invokeObjcSelf!(void, "saveDocumentWithDelegate:didSaveSelector:contextInfo:", Object, SEL, void*)(delegate_, didSaveSelector, contextInfo);
458 }
459
460 void runModalSavePanelForSaveOperation (uint saveOperation, Object delegate_, SEL didSaveSelector, void* contextInfo)
461 {
462 return invokeObjcSelf!(void, "runModalSavePanelForSaveOperation:delegate:didSaveSelector:contextInfo:", uint, Object, SEL, void*)(saveOperation, delegate_, didSaveSelector, contextInfo);
463 }
464
465 bool shouldRunSavePanelWithAccessoryView ()
466 {
467 return invokeObjcSelf!(bool, "shouldRunSavePanelWithAccessoryView");
468 }
469
470 bool prepareSavePanel (NSSavePanel savePanel)
471 {
472 return invokeObjcSelf!(bool, "prepareSavePanel:", NSSavePanel)(savePanel);
473 }
474
475 bool fileNameExtensionWasHiddenInLastRunSavePanel ()
476 {
477 return invokeObjcSelf!(bool, "fileNameExtensionWasHiddenInLastRunSavePanel");
478 }
479
480 NSString fileTypeFromLastRunSavePanel ()
481 {
482 return invokeObjcSelf!(NSString, "fileTypeFromLastRunSavePanel");
483 }
484
485 void saveToURL (NSURL absoluteURL, NSString typeName, uint saveOperation, Object delegate_, SEL didSaveSelector, void* contextInfo)
486 {
487 return invokeObjcSelf!(void, "saveToURL:ofType:forSaveOperation:delegate:didSaveSelector:contextInfo:", NSURL, NSString, uint, Object, SEL, void*)(absoluteURL, typeName, saveOperation, delegate_, didSaveSelector, contextInfo);
488 }
489
490 bool saveToURL (NSURL absoluteURL, NSString typeName, uint saveOperation, ref NSError outError)
491 {
492 id error;
493
494 if (outError)
495 error = new objc_object;
496
497 bool result = invokeObjcSelf!(bool, "saveToURL:ofType:forSaveOperation:error:", NSURL, NSString, uint, id*)(absoluteURL, typeName, saveOperation, &error);
498
499 if (error)
500 outError = new NSError(error);
501
502 return result;
503 }
504
505 bool hasUnautosavedChanges ()
506 {
507 return invokeObjcSelf!(bool, "hasUnautosavedChanges");
508 }
509
510 void autosaveDocumentWithDelegate (Object delegate_, SEL didAutosaveSelector, void* contextInfo)
511 {
512 return invokeObjcSelf!(void, "autosaveDocumentWithDelegate:didAutosaveSelector:contextInfo:", Object, SEL, void*)(delegate_, didAutosaveSelector, contextInfo);
513 }
514
515 NSString autosavingFileType ()
516 {
517 return invokeObjcSelf!(NSString, "autosavingFileType");
518 }
519
520 void setAutosavedContentsFileURL (NSURL absoluteURL)
521 {
522 return invokeObjcSelf!(void, "setAutosavedContentsFileURL:", NSURL)(absoluteURL);
523 }
524
525 NSURL autosavedContentsFileURL ()
526 {
527 return invokeObjcSelf!(NSURL, "autosavedContentsFileURL");
528 }
529
530 void canCloseDocumentWithDelegate (Object delegate_, SEL shouldCloseSelector, void* contextInfo)
531 {
532 return invokeObjcSelf!(void, "canCloseDocumentWithDelegate:shouldCloseSelector:contextInfo:", Object, SEL, void*)(delegate_, shouldCloseSelector, contextInfo);
533 }
534
535 void close ()
536 {
537 return invokeObjcSelf!(void, "close");
538 }
539
540 void runPageLayout (Object sender)
541 {
542 return invokeObjcSelf!(void, "runPageLayout:", Object)(sender);
543 }
544
545 void runModalPageLayoutWithPrintInfo (NSPrintInfo printInfo, Object delegate_, SEL didRunSelector, void* contextInfo)
546 {
547 return invokeObjcSelf!(void, "runModalPageLayoutWithPrintInfo:delegate:didRunSelector:contextInfo:", NSPrintInfo, Object, SEL, void*)(printInfo, delegate_, didRunSelector, contextInfo);
548 }
549
550 bool preparePageLayout (NSPageLayout pageLayout)
551 {
552 return invokeObjcSelf!(bool, "preparePageLayout:", NSPageLayout)(pageLayout);
553 }
554
555 bool shouldChangePrintInfo (NSPrintInfo newPrintInfo)
556 {
557 return invokeObjcSelf!(bool, "shouldChangePrintInfo:", NSPrintInfo)(newPrintInfo);
558 }
559
560 void setPrintInfo (NSPrintInfo printInfo)
561 {
562 return invokeObjcSelf!(void, "setPrintInfo:", NSPrintInfo)(printInfo);
563 }
564
565 NSPrintInfo printInfo ()
566 {
567 return invokeObjcSelf!(NSPrintInfo, "printInfo");
568 }
569
570 void printDocument (Object sender)
571 {
572 return invokeObjcSelf!(void, "printDocument:", Object)(sender);
573 }
574
575 void printDocumentWithSettings (NSDictionary printSettings, bool showPrintPanel, Object delegate_, SEL didPrintSelector, void* contextInfo)
576 {
577 return invokeObjcSelf!(void, "printDocumentWithSettings:showPrintPanel:delegate:didPrintSelector:contextInfo:", NSDictionary, bool, Object, SEL, void*)(printSettings, showPrintPanel, delegate_, didPrintSelector, contextInfo);
578 }
579
580 NSPrintOperation printOperationWithSettings (NSDictionary printSettings, ref NSError outError)
581 {
582 id error;
583
584 if (outError)
585 error = new objc_object;
586
587 NSPrintOperation result = invokeObjcSelf!(NSPrintOperation, "printOperationWithSettings:error:", NSDictionary, id*)(printSettings, &error);
588
589 if (error)
590 outError = new NSError(error);
591
592 return result;
593 }
594
595 void runModalPrintOperation (NSPrintOperation printOperation, Object delegate_, SEL didRunSelector, void* contextInfo)
596 {
597 return invokeObjcSelf!(void, "runModalPrintOperation:delegate:didRunSelector:contextInfo:", NSPrintOperation, Object, SEL, void*)(printOperation, delegate_, didRunSelector, contextInfo);
598 }
599
600 bool isDocumentEdited ()
601 {
602 return invokeObjcSelf!(bool, "isDocumentEdited");
603 }
604
605 void updateChangeCount (uint change)
606 {
607 return invokeObjcSelf!(void, "updateChangeCount:", uint)(change);
608 }
609
610 void setUndoManager (NSUndoManager undoManager)
611 {
612 return invokeObjcSelf!(void, "setUndoManager:", NSUndoManager)(undoManager);
613 }
614
615 NSUndoManager undoManager ()
616 {
617 return invokeObjcSelf!(NSUndoManager, "undoManager");
618 }
619
620 void setHasUndoManager (bool hasUndoManager)
621 {
622 return invokeObjcSelf!(void, "setHasUndoManager:", bool)(hasUndoManager);
623 }
624
625 bool hasUndoManager ()
626 {
627 return invokeObjcSelf!(bool, "hasUndoManager");
628 }
629
630 void presentError (NSError error, NSWindow window, Object delegate_, SEL didPresentSelector, void* contextInfo)
631 {
632 return invokeObjcSelf!(void, "presentError:modalForWindow:delegate:didPresentSelector:contextInfo:", NSError, NSWindow, Object, SEL, void*)(error, window, delegate_, didPresentSelector, contextInfo);
633 }
634
635 bool presentError (NSError error)
636 {
637 return invokeObjcSelf!(bool, "presentError:", NSError)(error);
638 }
639
640 NSError willPresentError (NSError error)
641 {
642 return invokeObjcSelf!(NSError, "willPresentError:", NSError)(error);
643 }
644
645 void makeWindowControllers ()
646 {
647 return invokeObjcSelf!(void, "makeWindowControllers");
648 }
649
650 NSString windowNibName ()
651 {
652 return invokeObjcSelf!(NSString, "windowNibName");
653 }
654
655 void windowControllerWillLoadNib (NSWindowController windowController)
656 {
657 return invokeObjcSelf!(void, "windowControllerWillLoadNib:", NSWindowController)(windowController);
658 }
659
660 void windowControllerDidLoadNib (NSWindowController windowController)
661 {
662 return invokeObjcSelf!(void, "windowControllerDidLoadNib:", NSWindowController)(windowController);
663 }
664
665 void setWindow (NSWindow window)
666 {
667 return invokeObjcSelf!(void, "setWindow:", NSWindow)(window);
668 }
669
670 void addWindowController (NSWindowController windowController)
671 {
672 return invokeObjcSelf!(void, "addWindowController:", NSWindowController)(windowController);
673 }
674
675 void removeWindowController (NSWindowController windowController)
676 {
677 return invokeObjcSelf!(void, "removeWindowController:", NSWindowController)(windowController);
678 }
679
680 void showWindows ()
681 {
682 return invokeObjcSelf!(void, "showWindows");
683 }
684
685 NSArray windowControllers ()
686 {
687 return invokeObjcSelf!(NSArray, "windowControllers");
688 }
689
690 void shouldCloseWindowController (NSWindowController windowController, Object delegate_, SEL shouldCloseSelector, void* contextInfo)
691 {
692 return invokeObjcSelf!(void, "shouldCloseWindowController:delegate:shouldCloseSelector:contextInfo:", NSWindowController, Object, SEL, void*)(windowController, delegate_, shouldCloseSelector, contextInfo);
693 }
694
695 NSString displayName ()
696 {
697 return invokeObjcSelf!(NSString, "displayName");
698 }
699
700 NSWindow windowForSheet ()
701 {
702 return invokeObjcSelf!(NSWindow, "windowForSheet");
703 }
704
705 static NSArray readableTypes ()
706 {
707 return invokeObjcSelfClass!(NSArray, "readableTypes");
708 }
709
710 static NSArray writableTypes ()
711 {
712 return invokeObjcSelfClass!(NSArray, "writableTypes");
713 }
714
715 static bool isNativeType (NSString type)
716 {
717 return invokeObjcSelfClass!(bool, "isNativeType:", NSString)(type);
718 }
719
720 NSArray writableTypesForSaveOperation (uint saveOperation)
721 {
722 return invokeObjcSelf!(NSArray, "writableTypesForSaveOperation:", uint)(saveOperation);
723 }
724
725 NSString fileNameExtensionForType (NSString typeName, uint saveOperation)
726 {
727 return invokeObjcSelf!(NSString, "fileNameExtensionForType:saveOperation:", NSString, uint)(typeName, saveOperation);
728 }
729
730 bool validateUserInterfaceItem (INSValidatedUserInterfaceItem anItem)
731 {
732 return invokeObjcSelf!(bool, "validateUserInterfaceItem:", INSValidatedUserInterfaceItem)(anItem);
733 }
734
735 bool validateUserInterfaceItem (INSValidatedUserInterfaceItem anItem)
736 {
737 return invokeObjcSelf!(bool, "validateUserInterfaceItem:", INSValidatedUserInterfaceItem)(anItem);
738 }
739
740 // NSDeprecated
741 NSData dataRepresentationOfType (NSString type)
742 {
743 return invokeObjcSelf!(NSData, "dataRepresentationOfType:", NSString)(type);
744 }
745
746 NSDictionary fileAttributesToWriteToFile (NSString fullDocumentPath, NSString documentTypeName, uint saveOperationType)
747 {
748 return invokeObjcSelf!(NSDictionary, "fileAttributesToWriteToFile:ofType:saveOperation:", NSString, NSString, uint)(fullDocumentPath, documentTypeName, saveOperationType);
749 }
750
751 NSString fileName ()
752 {
753 return invokeObjcSelf!(NSString, "fileName");
754 }
755
756 NSFileWrapper fileWrapperRepresentationOfType (NSString type)
757 {
758 return invokeObjcSelf!(NSFileWrapper, "fileWrapperRepresentationOfType:", NSString)(type);
759 }
760
761 typeof(this) initWithContentsOfFile (NSString absolutePath, NSString typeName)
762 {
763 id result = invokeObjcSelf!(id, "initWithContentsOfFile:ofType:", NSString, NSString)(absolutePath, typeName);
764 return result is this.objcObject ? this : (result !is null ? new typeof(this)(result) : null);
765 }
766
767 this (NSString absolutePath, NSString typeName)
768 {
769 super(typeof(this).alloc.initWithContentsOfFile(absolutePath, typeName).objcObject);
770 }
771
772 typeof(this) initWithContentsOfURL (NSURL absoluteURL, NSString typeName)
773 {
774 id result = invokeObjcSelf!(id, "initWithContentsOfURL:ofType:", NSURL, NSString)(absoluteURL, typeName);
775 return result is this.objcObject ? this : (result !is null ? new typeof(this)(result) : null);
776 }
777
778 this (NSURL absoluteURL, NSString typeName)
779 {
780 super(typeof(this).alloc.initWithContentsOfURL(absoluteURL, typeName).objcObject);
781 }
782
783 bool loadDataRepresentation (NSData data, NSString type)
784 {
785 return invokeObjcSelf!(bool, "loadDataRepresentation:ofType:", NSData, NSString)(data, type);
786 }
787
788 bool loadFileWrapperRepresentation (NSFileWrapper wrapper, NSString type)
789 {
790 return invokeObjcSelf!(bool, "loadFileWrapperRepresentation:ofType:", NSFileWrapper, NSString)(wrapper, type);
791 }
792
793 void printShowingPrintPanel (bool flag)
794 {
795 return invokeObjcSelf!(void, "printShowingPrintPanel:", bool)(flag);
796 }
797
798 bool readFromFile (NSString fileName, NSString type)
799 {
800 return invokeObjcSelf!(bool, "readFromFile:ofType:", NSString, NSString)(fileName, type);
801 }
802
803 bool readFromURL (NSURL url, NSString type)
804 {
805 return invokeObjcSelf!(bool, "readFromURL:ofType:", NSURL, NSString)(url, type);
806 }
807
808 bool revertToSavedFromFile (NSString fileName, NSString type)
809 {
810 return invokeObjcSelf!(bool, "revertToSavedFromFile:ofType:", NSString, NSString)(fileName, type);
811 }
812
813 bool revertToSavedFromURL (NSURL url, NSString type)
814 {
815 return invokeObjcSelf!(bool, "revertToSavedFromURL:ofType:", NSURL, NSString)(url, type);
816 }
817
818 NSInteger runModalPageLayoutWithPrintInfo (NSPrintInfo printInfo)
819 {
820 return invokeObjcSelf!(NSInteger, "runModalPageLayoutWithPrintInfo:", NSPrintInfo)(printInfo);
821 }
822
823 void saveToFile (NSString fileName, uint saveOperation, Object delegate_, SEL didSaveSelector, void* contextInfo)
824 {
825 return invokeObjcSelf!(void, "saveToFile:saveOperation:delegate:didSaveSelector:contextInfo:", NSString, uint, Object, SEL, void*)(fileName, saveOperation, delegate_, didSaveSelector, contextInfo);
826 }
827
828 void setFileName (NSString fileName)
829 {
830 return invokeObjcSelf!(void, "setFileName:", NSString)(fileName);
831 }
832
833 bool writeToFile (NSString fileName, NSString type)
834 {
835 return invokeObjcSelf!(bool, "writeToFile:ofType:", NSString, NSString)(fileName, type);
836 }
837
838 bool writeToFile (NSString fullDocumentPath, NSString documentTypeName, NSString fullOriginalDocumentPath, uint saveOperationType)
839 {
840 return invokeObjcSelf!(bool, "writeToFile:ofType:originalFile:saveOperation:", NSString, NSString, NSString, uint)(fullDocumentPath, documentTypeName, fullOriginalDocumentPath, saveOperationType);
841 }
842
843 bool writeToURL (NSURL url, NSString type)
844 {
845 return invokeObjcSelf!(bool, "writeToURL:ofType:", NSURL, NSString)(url, type);
846 }
847
848 bool writeWithBackupToFile (NSString fullDocumentPath, NSString documentTypeName, uint saveOperationType)
849 {
850 return invokeObjcSelf!(bool, "writeWithBackupToFile:ofType:saveOperation:", NSString, NSString, uint)(fullDocumentPath, documentTypeName, saveOperationType);
851 }
852
853 // NSScripting
854 NSString lastComponentOfFileName ()
855 {
856 return invokeObjcSelf!(NSString, "lastComponentOfFileName");
857 }
858
859 void setLastComponentOfFileName (NSString str)
860 {
861 return invokeObjcSelf!(void, "setLastComponentOfFileName:", NSString)(str);
862 }
863
864 Object handleSaveScriptCommand (NSScriptCommand command)
865 {
866 return invokeObjcSelf!(Object, "handleSaveScriptCommand:", NSScriptCommand)(command);
867 }
868
869 Object handleCloseScriptCommand (NSCloseCommand command)
870 {
871 return invokeObjcSelf!(Object, "handleCloseScriptCommand:", NSCloseCommand)(command);
872 }
873
874 Object handlePrintScriptCommand (NSScriptCommand command)
875 {
876 return invokeObjcSelf!(Object, "handlePrintScriptCommand:", NSScriptCommand)(command);
877 }
878
879 NSScriptObjectSpecifier objectSpecifier ()
880 {
881 return invokeObjcSelf!(NSScriptObjectSpecifier, "objectSpecifier");
882 }
883 }