Mercurial > projects > dstep
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSDocument.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,883 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Sep 24, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.appkit.NSDocument; + +import dstep.appkit.NSDocumentScripting; +import dstep.appkit.NSFileWrapper; +import dstep.appkit.NSMenuItem; +import dstep.appkit.NSNibDeclarations; +import dstep.appkit.NSPageLayout; +import dstep.appkit.NSPrintInfo; +import dstep.appkit.NSPrintOperation; +import dstep.appkit.NSSavePanel; +import dstep.appkit.NSUserInterfaceValidation; +import dstep.appkit.NSView; +import dstep.appkit.NSWindow; +import dstep.appkit.NSWindowController; +import dstep.foundation.NSArray; +import dstep.foundation.NSData; +import dstep.foundation.NSDate; +import dstep.foundation.NSDictionary; +import dstep.foundation.NSError; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSObject; +import dstep.foundation.NSScriptCommand; +import dstep.foundation.NSScriptObjectSpecifiers; +import dstep.foundation.NSScriptStandardSuiteCommands; +import dstep.foundation.NSString; +import dstep.foundation.NSUndoManager; +import dstep.foundation.NSURL; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +alias NSUInteger NSDocumentChangeType; +alias NSUInteger NSSaveOperationType; + +enum +{ + NSChangeDone = 0, + NSChangeUndone = 1, + NSChangeCleared = 2, + NSChangeRedone = 5, + NSChangeReadOtherContents = 3, + NSChangeAutosaved = 4 +} + +enum +{ + NSSaveOperation = 0, + NSSaveAsOperation = 1, + NSSaveToOperation = 2, + NSAutosaveOperation = 3 +} + +const TNSDeprecated = ` + + NSData dataRepresentationOfType (NSString type) + { + return invokeObjcSelf!(NSData, "dataRepresentationOfType:", NSString)(type); + } + + NSDictionary fileAttributesToWriteToFile (NSString fullDocumentPath, NSString documentTypeName, uint saveOperationType) + { + return invokeObjcSelf!(NSDictionary, "fileAttributesToWriteToFile:ofType:saveOperation:", NSString, NSString, uint)(fullDocumentPath, documentTypeName, saveOperationType); + } + + NSString fileName () + { + return invokeObjcSelf!(NSString, "fileName"); + } + + NSFileWrapper fileWrapperRepresentationOfType (NSString type) + { + return invokeObjcSelf!(NSFileWrapper, "fileWrapperRepresentationOfType:", NSString)(type); + } + + typeof(this) initWithContentsOfFile (NSString absolutePath, NSString typeName) + { + id result = invokeObjcSelf!(id, "initWithContentsOfFile:ofType:", NSString, NSString)(absolutePath, typeName); + return result is this.objcObject ? this : (result !is null ? new typeof(this)(result) : null); + } + + this (NSString absolutePath, NSString typeName) + { + super(typeof(this).alloc.initWithContentsOfFile(absolutePath, typeName).objcObject); + } + + typeof(this) initWithContentsOfURL (NSURL absoluteURL, NSString typeName) + { + id result = invokeObjcSelf!(id, "initWithContentsOfURL:ofType:", NSURL, NSString)(absoluteURL, typeName); + return result is this.objcObject ? this : (result !is null ? new typeof(this)(result) : null); + } + + this (NSURL absoluteURL, NSString typeName) + { + super(typeof(this).alloc.initWithContentsOfURL(absoluteURL, typeName).objcObject); + } + + bool loadDataRepresentation (NSData data, NSString type) + { + return invokeObjcSelf!(bool, "loadDataRepresentation:ofType:", NSData, NSString)(data, type); + } + + bool loadFileWrapperRepresentation (NSFileWrapper wrapper, NSString type) + { + return invokeObjcSelf!(bool, "loadFileWrapperRepresentation:ofType:", NSFileWrapper, NSString)(wrapper, type); + } + + void printShowingPrintPanel (bool flag) + { + return invokeObjcSelf!(void, "printShowingPrintPanel:", bool)(flag); + } + + bool readFromFile (NSString fileName, NSString type) + { + return invokeObjcSelf!(bool, "readFromFile:ofType:", NSString, NSString)(fileName, type); + } + + bool readFromURL (NSURL url, NSString type) + { + return invokeObjcSelf!(bool, "readFromURL:ofType:", NSURL, NSString)(url, type); + } + + bool revertToSavedFromFile (NSString fileName, NSString type) + { + return invokeObjcSelf!(bool, "revertToSavedFromFile:ofType:", NSString, NSString)(fileName, type); + } + + bool revertToSavedFromURL (NSURL url, NSString type) + { + return invokeObjcSelf!(bool, "revertToSavedFromURL:ofType:", NSURL, NSString)(url, type); + } + + NSInteger runModalPageLayoutWithPrintInfo (NSPrintInfo printInfo) + { + return invokeObjcSelf!(NSInteger, "runModalPageLayoutWithPrintInfo:", NSPrintInfo)(printInfo); + } + + void saveToFile (NSString fileName, uint saveOperation, Object delegate_, SEL didSaveSelector, void* contextInfo) + { + return invokeObjcSelf!(void, "saveToFile:saveOperation:delegate:didSaveSelector:contextInfo:", NSString, uint, Object, SEL, void*)(fileName, saveOperation, delegate_, didSaveSelector, contextInfo); + } + + void setFileName (NSString fileName) + { + return invokeObjcSelf!(void, "setFileName:", NSString)(fileName); + } + + bool writeToFile (NSString fileName, NSString type) + { + return invokeObjcSelf!(bool, "writeToFile:ofType:", NSString, NSString)(fileName, type); + } + + bool writeToFile (NSString fullDocumentPath, NSString documentTypeName, NSString fullOriginalDocumentPath, uint saveOperationType) + { + return invokeObjcSelf!(bool, "writeToFile:ofType:originalFile:saveOperation:", NSString, NSString, NSString, uint)(fullDocumentPath, documentTypeName, fullOriginalDocumentPath, saveOperationType); + } + + bool writeToURL (NSURL url, NSString type) + { + return invokeObjcSelf!(bool, "writeToURL:ofType:", NSURL, NSString)(url, type); + } + + bool writeWithBackupToFile (NSString fullDocumentPath, NSString documentTypeName, uint saveOperationType) + { + return invokeObjcSelf!(bool, "writeWithBackupToFile:ofType:saveOperation:", NSString, NSString, uint)(fullDocumentPath, documentTypeName, saveOperationType); + } + + //mixin ObjcBindMethod!(dataRepresentationOfType, "dataRepresentationOfType:"); + //mixin ObjcBindMethod!(fileAttributesToWriteToFile, "fileAttributesToWriteToFile:ofType:saveOperation:"); + //mixin ObjcBindMethod!(fileName, "fileName"); + //mixin ObjcBindMethod!(fileWrapperRepresentationOfType, "fileWrapperRepresentationOfType:"); + //mixin ObjcBindMethod!(initWithContentsOfFile, "initWithContentsOfFile:ofType:"); + //mixin ObjcBindMethod!(initWithContentsOfURL, "initWithContentsOfURL:ofType:"); + //mixin ObjcBindMethod!(loadDataRepresentation, "loadDataRepresentation:ofType:"); + //mixin ObjcBindMethod!(loadFileWrapperRepresentation, "loadFileWrapperRepresentation:ofType:"); + //mixin ObjcBindMethod!(printShowingPrintPanel, "printShowingPrintPanel:"); + //mixin ObjcBindMethod!(readFromFile, "readFromFile:ofType:"); + ////mixin ObjcBindMethod!(readFromURL, "readFromURL:ofType:"); + //mixin ObjcBindMethod!(revertToSavedFromFile, "revertToSavedFromFile:ofType:"); + //mixin ObjcBindMethod!(revertToSavedFromURL, "revertToSavedFromURL:ofType:"); + //mixin ObjcBindMethod!(runModalPageLayoutWithPrintInfo, "runModalPageLayoutWithPrintInfo:"); + //mixin ObjcBindMethod!(saveToFile, "saveToFile:saveOperation:delegate:didSaveSelector:contextInfo:"); + //mixin ObjcBindMethod!(setFileName, "setFileName:"); + //mixin ObjcBindMethod!(writeToFile, "writeToFile:ofType:"); + //mixin ObjcBindMethod!(writeToFile, "writeToFile:ofType:originalFile:saveOperation:"); + ////mixin ObjcBindMethod!(writeToURL, "writeToURL:ofType:"); + //mixin ObjcBindMethod!(writeWithBackupToFile, "writeWithBackupToFile:ofType:saveOperation:"); + +`; + +class NSDocument : NSObject, INSUserInterfaceValidations +{ + mixin (ObjcWrap); + + NSDocument init () + { + id result = invokeObjcSelf!(id, "init"); + return result is this.objcObject ? this : (result !is null ? new NSDocument(result) : null); + } + + this () + { + super(NSDocument.alloc.init.objcObject); + } + + NSDocument initWithType (NSString typeName, ref NSError outError) + { + id error; + + if (outError) + error = new objc_object; + + id result = invokeObjcSelf!(id, "initWithType:error:", NSString, id*)(typeName, &error); + + if (error) + outError = new NSError(error); + + return result is this.objcObject ? this : (result !is null ? new NSDocument(result) : null); + } + + this (NSString typeName, ref NSError outError) + { + super(NSDocument.alloc.initWithType(typeName, outError).objcObject); + } + + NSDocument initForURL (NSURL absoluteDocumentURL, NSURL absoluteDocumentContentsURL, NSString typeName, ref NSError outError) + { + id error; + + if (outError) + error = new objc_object; + + id result = invokeObjcSelf!(id, "initForURL:withContentsOfURL:ofType:error:", NSURL, NSURL, NSString, id*)(absoluteDocumentURL, absoluteDocumentContentsURL, typeName, &error); + + if (error) + outError = new NSError(error); + + return result is this.objcObject ? this : (result !is null ? new NSDocument(result) : null); + } + + this (NSURL absoluteDocumentURL, NSURL absoluteDocumentContentsURL, NSString typeName, ref NSError outError) + { + super(NSDocument.alloc.initForURL(absoluteDocumentURL, absoluteDocumentContentsURL, typeName, outError).objcObject); + } + + void setFileType (NSString typeName) + { + return invokeObjcSelf!(void, "setFileType:", NSString)(typeName); + } + + NSString fileType () + { + return invokeObjcSelf!(NSString, "fileType"); + } + + void setFileURL (NSURL absoluteURL) + { + return invokeObjcSelf!(void, "setFileURL:", NSURL)(absoluteURL); + } + + NSURL fileURL () + { + return invokeObjcSelf!(NSURL, "fileURL"); + } + + void setFileModificationDate (NSDate modificationDate) + { + return invokeObjcSelf!(void, "setFileModificationDate:", NSDate)(modificationDate); + } + + NSDate fileModificationDate () + { + return invokeObjcSelf!(NSDate, "fileModificationDate"); + } + + void revertDocumentToSaved (Object sender) + { + return invokeObjcSelf!(void, "revertDocumentToSaved:", Object)(sender); + } + + bool revertToContentsOfURL (NSURL absoluteURL, NSString typeName, ref NSError outError) + { + id error; + + if (outError) + error = new objc_object; + + bool result = invokeObjcSelf!(bool, "revertToContentsOfURL:ofType:error:", NSURL, NSString, id*)(absoluteURL, typeName, &error); + + if (error) + outError = new NSError(error); + + return result; + } + + bool readFromURL (NSURL absoluteURL, NSString typeName, ref NSError outError) + { + id error; + + if (outError) + error = outError.objcObject; + + bool result = invokeObjcSelf!(bool, "readFromURL:ofType:error:", NSURL, NSString, id*)(absoluteURL, typeName, &error); + + if (error) + outError = new NSError(error); + + return result; + } + + bool readFromFileWrapper (NSFileWrapper fileWrapper, NSString typeName, ref NSError outError) + { + id error; + + if (outError) + error = new objc_object; + + bool result = invokeObjcSelf!(bool, "readFromFileWrapper:ofType:error:", NSFileWrapper, NSString, id*)(fileWrapper, typeName, &error); + + if (error) + outError = new NSError(error); + + return result; + } + + bool readFromData (NSData data, NSString typeName, ref NSError outError) + { + id error; + + if (outError) + error = new objc_object; + + bool result = invokeObjcSelf!(bool, "readFromData:ofType:error:", NSData, NSString, id*)(data, typeName, &error); + + if (error) + outError = new NSError(error); + + return result; + } + + bool writeToURL (NSURL absoluteURL, NSString typeName, ref NSError outError) + { + id error; + + if (outError) + error = new objc_object; + + bool result = invokeObjcSelf!(bool, "writeToURL:ofType:error:", NSURL, NSString, id*)(absoluteURL, typeName, &error); + + if (error) + outError = new NSError(error); + + return result; + } + + NSFileWrapper fileWrapperOfType (NSString typeName, ref NSError outError) + { + id error; + + if (outError) + error = new objc_object; + + NSFileWrapper result = invokeObjcSelf!(NSFileWrapper, "fileWrapperOfType:error:", NSString, id*)(typeName, &error); + + if (error) + outError = new NSError(error); + + return result; + } + + NSData dataOfType (NSString typeName, ref NSError outError) + { + id error; + + if (outError) + error = new objc_object; + + NSData result = invokeObjcSelf!(NSData, "dataOfType:error:", NSString, id*)(typeName, &error); + + if (error) + outError = new NSError(error); + + return result; + } + + bool writeSafelyToURL (NSURL absoluteURL, NSString typeName, uint saveOperation, ref NSError outError) + { + id error; + + if (outError) + error = new objc_object; + + bool result = invokeObjcSelf!(bool, "writeSafelyToURL:ofType:forSaveOperation:error:", NSURL, NSString, uint, id*)(absoluteURL, typeName, saveOperation, &error); + + if (error) + outError = new NSError(error); + + return result; + } + + bool writeToURL (NSURL absoluteURL, NSString typeName, uint saveOperation, NSURL absoluteOriginalContentsURL, ref NSError outError) + { + id error; + + if (outError) + error = new objc_object; + + bool result = invokeObjcSelf!(bool, "writeToURL:ofType:forSaveOperation:originalContentsURL:error:", NSURL, NSString, uint, NSURL, id*)(absoluteURL, typeName, saveOperation, absoluteOriginalContentsURL, &error); + + if (error) + outError = new NSError(error); + + return result; + } + + NSDictionary fileAttributesToWriteToURL (NSURL absoluteURL, NSString typeName, uint saveOperation, NSURL absoluteOriginalContentsURL, ref NSError outError) + { + id error; + + if (outError) + error = new objc_object; + + NSDictionary result = invokeObjcSelf!(NSDictionary, "fileAttributesToWriteToURL:ofType:forSaveOperation:originalContentsURL:error:", NSURL, NSString, uint, NSURL, id*)(absoluteURL, typeName, saveOperation, absoluteOriginalContentsURL, &error); + + if (error) + outError = new NSError(error); + + return result; + } + + bool keepBackupFile () + { + return invokeObjcSelf!(bool, "keepBackupFile"); + } + + void saveDocument (Object sender) + { + return invokeObjcSelf!(void, "saveDocument:", Object)(sender); + } + + void saveDocumentAs (Object sender) + { + return invokeObjcSelf!(void, "saveDocumentAs:", Object)(sender); + } + + void saveDocumentTo (Object sender) + { + return invokeObjcSelf!(void, "saveDocumentTo:", Object)(sender); + } + + void saveDocumentWithDelegate (Object delegate_, SEL didSaveSelector, void* contextInfo) + { + return invokeObjcSelf!(void, "saveDocumentWithDelegate:didSaveSelector:contextInfo:", Object, SEL, void*)(delegate_, didSaveSelector, contextInfo); + } + + void runModalSavePanelForSaveOperation (uint saveOperation, Object delegate_, SEL didSaveSelector, void* contextInfo) + { + return invokeObjcSelf!(void, "runModalSavePanelForSaveOperation:delegate:didSaveSelector:contextInfo:", uint, Object, SEL, void*)(saveOperation, delegate_, didSaveSelector, contextInfo); + } + + bool shouldRunSavePanelWithAccessoryView () + { + return invokeObjcSelf!(bool, "shouldRunSavePanelWithAccessoryView"); + } + + bool prepareSavePanel (NSSavePanel savePanel) + { + return invokeObjcSelf!(bool, "prepareSavePanel:", NSSavePanel)(savePanel); + } + + bool fileNameExtensionWasHiddenInLastRunSavePanel () + { + return invokeObjcSelf!(bool, "fileNameExtensionWasHiddenInLastRunSavePanel"); + } + + NSString fileTypeFromLastRunSavePanel () + { + return invokeObjcSelf!(NSString, "fileTypeFromLastRunSavePanel"); + } + + void saveToURL (NSURL absoluteURL, NSString typeName, uint saveOperation, Object delegate_, SEL didSaveSelector, void* contextInfo) + { + return invokeObjcSelf!(void, "saveToURL:ofType:forSaveOperation:delegate:didSaveSelector:contextInfo:", NSURL, NSString, uint, Object, SEL, void*)(absoluteURL, typeName, saveOperation, delegate_, didSaveSelector, contextInfo); + } + + bool saveToURL (NSURL absoluteURL, NSString typeName, uint saveOperation, ref NSError outError) + { + id error; + + if (outError) + error = new objc_object; + + bool result = invokeObjcSelf!(bool, "saveToURL:ofType:forSaveOperation:error:", NSURL, NSString, uint, id*)(absoluteURL, typeName, saveOperation, &error); + + if (error) + outError = new NSError(error); + + return result; + } + + bool hasUnautosavedChanges () + { + return invokeObjcSelf!(bool, "hasUnautosavedChanges"); + } + + void autosaveDocumentWithDelegate (Object delegate_, SEL didAutosaveSelector, void* contextInfo) + { + return invokeObjcSelf!(void, "autosaveDocumentWithDelegate:didAutosaveSelector:contextInfo:", Object, SEL, void*)(delegate_, didAutosaveSelector, contextInfo); + } + + NSString autosavingFileType () + { + return invokeObjcSelf!(NSString, "autosavingFileType"); + } + + void setAutosavedContentsFileURL (NSURL absoluteURL) + { + return invokeObjcSelf!(void, "setAutosavedContentsFileURL:", NSURL)(absoluteURL); + } + + NSURL autosavedContentsFileURL () + { + return invokeObjcSelf!(NSURL, "autosavedContentsFileURL"); + } + + void canCloseDocumentWithDelegate (Object delegate_, SEL shouldCloseSelector, void* contextInfo) + { + return invokeObjcSelf!(void, "canCloseDocumentWithDelegate:shouldCloseSelector:contextInfo:", Object, SEL, void*)(delegate_, shouldCloseSelector, contextInfo); + } + + void close () + { + return invokeObjcSelf!(void, "close"); + } + + void runPageLayout (Object sender) + { + return invokeObjcSelf!(void, "runPageLayout:", Object)(sender); + } + + void runModalPageLayoutWithPrintInfo (NSPrintInfo printInfo, Object delegate_, SEL didRunSelector, void* contextInfo) + { + return invokeObjcSelf!(void, "runModalPageLayoutWithPrintInfo:delegate:didRunSelector:contextInfo:", NSPrintInfo, Object, SEL, void*)(printInfo, delegate_, didRunSelector, contextInfo); + } + + bool preparePageLayout (NSPageLayout pageLayout) + { + return invokeObjcSelf!(bool, "preparePageLayout:", NSPageLayout)(pageLayout); + } + + bool shouldChangePrintInfo (NSPrintInfo newPrintInfo) + { + return invokeObjcSelf!(bool, "shouldChangePrintInfo:", NSPrintInfo)(newPrintInfo); + } + + void setPrintInfo (NSPrintInfo printInfo) + { + return invokeObjcSelf!(void, "setPrintInfo:", NSPrintInfo)(printInfo); + } + + NSPrintInfo printInfo () + { + return invokeObjcSelf!(NSPrintInfo, "printInfo"); + } + + void printDocument (Object sender) + { + return invokeObjcSelf!(void, "printDocument:", Object)(sender); + } + + void printDocumentWithSettings (NSDictionary printSettings, bool showPrintPanel, Object delegate_, SEL didPrintSelector, void* contextInfo) + { + return invokeObjcSelf!(void, "printDocumentWithSettings:showPrintPanel:delegate:didPrintSelector:contextInfo:", NSDictionary, bool, Object, SEL, void*)(printSettings, showPrintPanel, delegate_, didPrintSelector, contextInfo); + } + + NSPrintOperation printOperationWithSettings (NSDictionary printSettings, ref NSError outError) + { + id error; + + if (outError) + error = new objc_object; + + NSPrintOperation result = invokeObjcSelf!(NSPrintOperation, "printOperationWithSettings:error:", NSDictionary, id*)(printSettings, &error); + + if (error) + outError = new NSError(error); + + return result; + } + + void runModalPrintOperation (NSPrintOperation printOperation, Object delegate_, SEL didRunSelector, void* contextInfo) + { + return invokeObjcSelf!(void, "runModalPrintOperation:delegate:didRunSelector:contextInfo:", NSPrintOperation, Object, SEL, void*)(printOperation, delegate_, didRunSelector, contextInfo); + } + + bool isDocumentEdited () + { + return invokeObjcSelf!(bool, "isDocumentEdited"); + } + + void updateChangeCount (uint change) + { + return invokeObjcSelf!(void, "updateChangeCount:", uint)(change); + } + + void setUndoManager (NSUndoManager undoManager) + { + return invokeObjcSelf!(void, "setUndoManager:", NSUndoManager)(undoManager); + } + + NSUndoManager undoManager () + { + return invokeObjcSelf!(NSUndoManager, "undoManager"); + } + + void setHasUndoManager (bool hasUndoManager) + { + return invokeObjcSelf!(void, "setHasUndoManager:", bool)(hasUndoManager); + } + + bool hasUndoManager () + { + return invokeObjcSelf!(bool, "hasUndoManager"); + } + + void presentError (NSError error, NSWindow window, Object delegate_, SEL didPresentSelector, void* contextInfo) + { + return invokeObjcSelf!(void, "presentError:modalForWindow:delegate:didPresentSelector:contextInfo:", NSError, NSWindow, Object, SEL, void*)(error, window, delegate_, didPresentSelector, contextInfo); + } + + bool presentError (NSError error) + { + return invokeObjcSelf!(bool, "presentError:", NSError)(error); + } + + NSError willPresentError (NSError error) + { + return invokeObjcSelf!(NSError, "willPresentError:", NSError)(error); + } + + void makeWindowControllers () + { + return invokeObjcSelf!(void, "makeWindowControllers"); + } + + NSString windowNibName () + { + return invokeObjcSelf!(NSString, "windowNibName"); + } + + void windowControllerWillLoadNib (NSWindowController windowController) + { + return invokeObjcSelf!(void, "windowControllerWillLoadNib:", NSWindowController)(windowController); + } + + void windowControllerDidLoadNib (NSWindowController windowController) + { + return invokeObjcSelf!(void, "windowControllerDidLoadNib:", NSWindowController)(windowController); + } + + void setWindow (NSWindow window) + { + return invokeObjcSelf!(void, "setWindow:", NSWindow)(window); + } + + void addWindowController (NSWindowController windowController) + { + return invokeObjcSelf!(void, "addWindowController:", NSWindowController)(windowController); + } + + void removeWindowController (NSWindowController windowController) + { + return invokeObjcSelf!(void, "removeWindowController:", NSWindowController)(windowController); + } + + void showWindows () + { + return invokeObjcSelf!(void, "showWindows"); + } + + NSArray windowControllers () + { + return invokeObjcSelf!(NSArray, "windowControllers"); + } + + void shouldCloseWindowController (NSWindowController windowController, Object delegate_, SEL shouldCloseSelector, void* contextInfo) + { + return invokeObjcSelf!(void, "shouldCloseWindowController:delegate:shouldCloseSelector:contextInfo:", NSWindowController, Object, SEL, void*)(windowController, delegate_, shouldCloseSelector, contextInfo); + } + + NSString displayName () + { + return invokeObjcSelf!(NSString, "displayName"); + } + + NSWindow windowForSheet () + { + return invokeObjcSelf!(NSWindow, "windowForSheet"); + } + + static NSArray readableTypes () + { + return invokeObjcSelfClass!(NSArray, "readableTypes"); + } + + static NSArray writableTypes () + { + return invokeObjcSelfClass!(NSArray, "writableTypes"); + } + + static bool isNativeType (NSString type) + { + return invokeObjcSelfClass!(bool, "isNativeType:", NSString)(type); + } + + NSArray writableTypesForSaveOperation (uint saveOperation) + { + return invokeObjcSelf!(NSArray, "writableTypesForSaveOperation:", uint)(saveOperation); + } + + NSString fileNameExtensionForType (NSString typeName, uint saveOperation) + { + return invokeObjcSelf!(NSString, "fileNameExtensionForType:saveOperation:", NSString, uint)(typeName, saveOperation); + } + + bool validateUserInterfaceItem (INSValidatedUserInterfaceItem anItem) + { + return invokeObjcSelf!(bool, "validateUserInterfaceItem:", INSValidatedUserInterfaceItem)(anItem); + } + + bool validateUserInterfaceItem (INSValidatedUserInterfaceItem anItem) + { + return invokeObjcSelf!(bool, "validateUserInterfaceItem:", INSValidatedUserInterfaceItem)(anItem); + } + + // NSDeprecated + NSData dataRepresentationOfType (NSString type) + { + return invokeObjcSelf!(NSData, "dataRepresentationOfType:", NSString)(type); + } + + NSDictionary fileAttributesToWriteToFile (NSString fullDocumentPath, NSString documentTypeName, uint saveOperationType) + { + return invokeObjcSelf!(NSDictionary, "fileAttributesToWriteToFile:ofType:saveOperation:", NSString, NSString, uint)(fullDocumentPath, documentTypeName, saveOperationType); + } + + NSString fileName () + { + return invokeObjcSelf!(NSString, "fileName"); + } + + NSFileWrapper fileWrapperRepresentationOfType (NSString type) + { + return invokeObjcSelf!(NSFileWrapper, "fileWrapperRepresentationOfType:", NSString)(type); + } + + typeof(this) initWithContentsOfFile (NSString absolutePath, NSString typeName) + { + id result = invokeObjcSelf!(id, "initWithContentsOfFile:ofType:", NSString, NSString)(absolutePath, typeName); + return result is this.objcObject ? this : (result !is null ? new typeof(this)(result) : null); + } + + this (NSString absolutePath, NSString typeName) + { + super(typeof(this).alloc.initWithContentsOfFile(absolutePath, typeName).objcObject); + } + + typeof(this) initWithContentsOfURL (NSURL absoluteURL, NSString typeName) + { + id result = invokeObjcSelf!(id, "initWithContentsOfURL:ofType:", NSURL, NSString)(absoluteURL, typeName); + return result is this.objcObject ? this : (result !is null ? new typeof(this)(result) : null); + } + + this (NSURL absoluteURL, NSString typeName) + { + super(typeof(this).alloc.initWithContentsOfURL(absoluteURL, typeName).objcObject); + } + + bool loadDataRepresentation (NSData data, NSString type) + { + return invokeObjcSelf!(bool, "loadDataRepresentation:ofType:", NSData, NSString)(data, type); + } + + bool loadFileWrapperRepresentation (NSFileWrapper wrapper, NSString type) + { + return invokeObjcSelf!(bool, "loadFileWrapperRepresentation:ofType:", NSFileWrapper, NSString)(wrapper, type); + } + + void printShowingPrintPanel (bool flag) + { + return invokeObjcSelf!(void, "printShowingPrintPanel:", bool)(flag); + } + + bool readFromFile (NSString fileName, NSString type) + { + return invokeObjcSelf!(bool, "readFromFile:ofType:", NSString, NSString)(fileName, type); + } + + bool readFromURL (NSURL url, NSString type) + { + return invokeObjcSelf!(bool, "readFromURL:ofType:", NSURL, NSString)(url, type); + } + + bool revertToSavedFromFile (NSString fileName, NSString type) + { + return invokeObjcSelf!(bool, "revertToSavedFromFile:ofType:", NSString, NSString)(fileName, type); + } + + bool revertToSavedFromURL (NSURL url, NSString type) + { + return invokeObjcSelf!(bool, "revertToSavedFromURL:ofType:", NSURL, NSString)(url, type); + } + + NSInteger runModalPageLayoutWithPrintInfo (NSPrintInfo printInfo) + { + return invokeObjcSelf!(NSInteger, "runModalPageLayoutWithPrintInfo:", NSPrintInfo)(printInfo); + } + + void saveToFile (NSString fileName, uint saveOperation, Object delegate_, SEL didSaveSelector, void* contextInfo) + { + return invokeObjcSelf!(void, "saveToFile:saveOperation:delegate:didSaveSelector:contextInfo:", NSString, uint, Object, SEL, void*)(fileName, saveOperation, delegate_, didSaveSelector, contextInfo); + } + + void setFileName (NSString fileName) + { + return invokeObjcSelf!(void, "setFileName:", NSString)(fileName); + } + + bool writeToFile (NSString fileName, NSString type) + { + return invokeObjcSelf!(bool, "writeToFile:ofType:", NSString, NSString)(fileName, type); + } + + bool writeToFile (NSString fullDocumentPath, NSString documentTypeName, NSString fullOriginalDocumentPath, uint saveOperationType) + { + return invokeObjcSelf!(bool, "writeToFile:ofType:originalFile:saveOperation:", NSString, NSString, NSString, uint)(fullDocumentPath, documentTypeName, fullOriginalDocumentPath, saveOperationType); + } + + bool writeToURL (NSURL url, NSString type) + { + return invokeObjcSelf!(bool, "writeToURL:ofType:", NSURL, NSString)(url, type); + } + + bool writeWithBackupToFile (NSString fullDocumentPath, NSString documentTypeName, uint saveOperationType) + { + return invokeObjcSelf!(bool, "writeWithBackupToFile:ofType:saveOperation:", NSString, NSString, uint)(fullDocumentPath, documentTypeName, saveOperationType); + } + + // NSScripting + NSString lastComponentOfFileName () + { + return invokeObjcSelf!(NSString, "lastComponentOfFileName"); + } + + void setLastComponentOfFileName (NSString str) + { + return invokeObjcSelf!(void, "setLastComponentOfFileName:", NSString)(str); + } + + Object handleSaveScriptCommand (NSScriptCommand command) + { + return invokeObjcSelf!(Object, "handleSaveScriptCommand:", NSScriptCommand)(command); + } + + Object handleCloseScriptCommand (NSCloseCommand command) + { + return invokeObjcSelf!(Object, "handleCloseScriptCommand:", NSCloseCommand)(command); + } + + Object handlePrintScriptCommand (NSScriptCommand command) + { + return invokeObjcSelf!(Object, "handlePrintScriptCommand:", NSScriptCommand)(command); + } + + NSScriptObjectSpecifier objectSpecifier () + { + return invokeObjcSelf!(NSScriptObjectSpecifier, "objectSpecifier"); + } +} \ No newline at end of file