Mercurial > projects > dstep
diff dstep/appkit/NSPrintOperation.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 | b9de51448c6b |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSPrintOperation.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,228 @@ +/** + * 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.NSPrintOperation; + +import dstep.appkit.AppKitDefines; +import dstep.appkit.NSGraphicsContext; +import dstep.appkit.NSPrintInfo; +import dstep.appkit.NSPrintPanel; +import dstep.appkit.NSView; +import dstep.appkit.NSWindow; +import dstep.foundation.NSData; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.foundation.NSRange; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +import bindings = dstep.appkit.NSPrintOperation_bindings; + +alias NSInteger NSPrintingPageOrder; + +private +{ + NSString NSPrintOperationExistsException_; +} + +NSString NSPrintOperationExistsException () +{ + if (NSPrintOperationExistsException_) + return NSPrintOperationExistsException_; + + return NSPrintOperationExistsException_ = new NSString(bindings.NSPrintOperationExistsException); +} + +enum +{ + NSDescendingPageOrder = -1, + NSSpecialPageOrder = 0, + NSAscendingPageOrder = 1, + NSUnknownPageOrder = 2 +} + +class NSPrintOperation : NSObject +{ + mixin (ObjcWrap); + + static NSPrintOperation printOperationWithView (NSView view, NSPrintInfo printInfo) + { + return invokeObjcSelfClass!(NSPrintOperation, "printOperationWithView:printInfo:", NSView, NSPrintInfo)(view, printInfo); + } + + static NSPrintOperation PDFOperationWithView (NSView view, NSRect rect, NSMutableData data, NSPrintInfo printInfo) + { + return invokeObjcSelfClass!(NSPrintOperation, "PDFOperationWithView:insideRect:toData:printInfo:", NSView, NSRect, NSMutableData, NSPrintInfo)(view, rect, data, printInfo); + } + + static NSPrintOperation PDFOperationWithView (NSView view, NSRect rect, NSString path, NSPrintInfo printInfo) + { + return invokeObjcSelfClass!(NSPrintOperation, "PDFOperationWithView:insideRect:toPath:printInfo:", NSView, NSRect, NSString, NSPrintInfo)(view, rect, path, printInfo); + } + + static NSPrintOperation EPSOperationWithView (NSView view, NSRect rect, NSMutableData data, NSPrintInfo printInfo) + { + return invokeObjcSelfClass!(NSPrintOperation, "EPSOperationWithView:insideRect:toData:printInfo:", NSView, NSRect, NSMutableData, NSPrintInfo)(view, rect, data, printInfo); + } + + static NSPrintOperation EPSOperationWithView (NSView view, NSRect rect, NSString path, NSPrintInfo printInfo) + { + return invokeObjcSelfClass!(NSPrintOperation, "EPSOperationWithView:insideRect:toPath:printInfo:", NSView, NSRect, NSString, NSPrintInfo)(view, rect, path, printInfo); + } + + static NSPrintOperation printOperationWithView (NSView view) + { + return invokeObjcSelfClass!(NSPrintOperation, "printOperationWithView:", NSView)(view); + } + + static NSPrintOperation PDFOperationWithView (NSView view, NSRect rect, NSMutableData data) + { + return invokeObjcSelfClass!(NSPrintOperation, "PDFOperationWithView:insideRect:toData:", NSView, NSRect, NSMutableData)(view, rect, data); + } + + static NSPrintOperation EPSOperationWithView (NSView view, NSRect rect, NSMutableData data) + { + return invokeObjcSelfClass!(NSPrintOperation, "EPSOperationWithView:insideRect:toData:", NSView, NSRect, NSMutableData)(view, rect, data); + } + + static NSPrintOperation currentOperation () + { + return invokeObjcSelfClass!(NSPrintOperation, "currentOperation"); + } + + static void setCurrentOperation (NSPrintOperation operation) + { + return invokeObjcSelfClass!(void, "setCurrentOperation:", NSPrintOperation)(operation); + } + + bool isCopyingOperation () + { + return invokeObjcSelf!(bool, "isCopyingOperation"); + } + + void setJobTitle (NSString jobTitle) + { + return invokeObjcSelf!(void, "setJobTitle:", NSString)(jobTitle); + } + + NSString jobTitle () + { + return invokeObjcSelf!(NSString, "jobTitle"); + } + + void setShowsPrintPanel (bool flag) + { + return invokeObjcSelf!(void, "setShowsPrintPanel:", bool)(flag); + } + + bool showsPrintPanel () + { + return invokeObjcSelf!(bool, "showsPrintPanel"); + } + + void setShowsProgressPanel (bool flag) + { + return invokeObjcSelf!(void, "setShowsProgressPanel:", bool)(flag); + } + + bool showsProgressPanel () + { + return invokeObjcSelf!(bool, "showsProgressPanel"); + } + + void setPrintPanel (NSPrintPanel panel) + { + return invokeObjcSelf!(void, "setPrintPanel:", NSPrintPanel)(panel); + } + + NSPrintPanel printPanel () + { + return invokeObjcSelf!(NSPrintPanel, "printPanel"); + } + + void setCanSpawnSeparateThread (bool canSpawnSeparateThread) + { + return invokeObjcSelf!(void, "setCanSpawnSeparateThread:", bool)(canSpawnSeparateThread); + } + + bool canSpawnSeparateThread () + { + return invokeObjcSelf!(bool, "canSpawnSeparateThread"); + } + + void setPageOrder (int pageOrder) + { + return invokeObjcSelf!(void, "setPageOrder:", int)(pageOrder); + } + + int pageOrder () + { + return invokeObjcSelf!(int, "pageOrder"); + } + + void runOperationModalForWindow (NSWindow docWindow, Object delegate_, SEL didRunSelector, void* contextInfo) + { + return invokeObjcSelf!(void, "runOperationModalForWindow:delegate:didRunSelector:contextInfo:", NSWindow, Object, SEL, void*)(docWindow, delegate_, didRunSelector, contextInfo); + } + + bool runOperation () + { + return invokeObjcSelf!(bool, "runOperation"); + } + + NSView view () + { + return invokeObjcSelf!(NSView, "view"); + } + + NSPrintInfo printInfo () + { + return invokeObjcSelf!(NSPrintInfo, "printInfo"); + } + + void setPrintInfo (NSPrintInfo printInfo) + { + return invokeObjcSelf!(void, "setPrintInfo:", NSPrintInfo)(printInfo); + } + + NSGraphicsContext context () + { + return invokeObjcSelf!(NSGraphicsContext, "context"); + } + + NSRange pageRange () + { + return invokeObjcSelf!(NSRange, "pageRange"); + } + + NSInteger currentPage () + { + return invokeObjcSelf!(NSInteger, "currentPage"); + } + + NSGraphicsContext createContext () + { + return invokeObjcSelf!(NSGraphicsContext, "createContext"); + } + + void destroyContext () + { + return invokeObjcSelf!(void, "destroyContext"); + } + + bool deliverResult () + { + return invokeObjcSelf!(bool, "deliverResult"); + } + + void cleanUpOperation () + { + return invokeObjcSelf!(void, "cleanUpOperation"); + } +} +