Mercurial > projects > dstep
diff dstep/foundation/NSUndoManager.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 | 89f3c3ef1fd2 |
children | b9de51448c6b |
line wrap: on
line diff
--- a/dstep/foundation/NSUndoManager.d Mon Aug 03 15:31:48 2009 +0200 +++ b/dstep/foundation/NSUndoManager.d Sun Jan 03 22:06:11 2010 +0100 @@ -7,41 +7,102 @@ module dstep.foundation.NSUndoManager; import dstep.foundation.NSArray; +import dstep.foundation.NSObjCRuntime; import dstep.foundation.NSObject; import dstep.foundation.NSString; import dstep.objc.bridge.Bridge; -import dstep.objc.objc : id; +import dstep.objc.objc; + + import bindings = dstep.foundation.NSUndoManager_bindings; -const NSString NSUndoManagerCheckpointNotification; -const NSString NSUndoManagerWillUndoChangeNotification; -const NSString NSUndoManagerWillRedoChangeNotification; -const NSString NSUndoManagerDidUndoChangeNotification; -const NSString NSUndoManagerDidRedoChangeNotification; -const NSString NSUndoManagerDidOpenUndoGroupNotification; -const NSString NSUndoManagerWillCloseUndoGroupNotification; +private +{ + NSString NSUndoManagerCheckpointNotification_; + NSString NSUndoManagerWillUndoChangeNotification_; + NSString NSUndoManagerWillRedoChangeNotification_; + NSString NSUndoManagerDidUndoChangeNotification_; + NSString NSUndoManagerDidRedoChangeNotification_; + NSString NSUndoManagerDidOpenUndoGroupNotification_; + NSString NSUndoManagerWillCloseUndoGroupNotification_; +} + +NSString NSUndoManagerCheckpointNotification () +{ + if (NSUndoManagerCheckpointNotification_) + return NSUndoManagerCheckpointNotification_; + + return NSUndoManagerCheckpointNotification_ = new NSString(bindings.NSUndoManagerCheckpointNotification); +} + +NSString NSUndoManagerWillUndoChangeNotification () +{ + if (NSUndoManagerWillUndoChangeNotification_) + return NSUndoManagerWillUndoChangeNotification_; + + return NSUndoManagerWillUndoChangeNotification_ = new NSString(bindings.NSUndoManagerWillUndoChangeNotification); +} + +NSString NSUndoManagerWillRedoChangeNotification () +{ + if (NSUndoManagerWillRedoChangeNotification_) + return NSUndoManagerWillRedoChangeNotification_; + + return NSUndoManagerWillRedoChangeNotification_ = new NSString(bindings.NSUndoManagerWillRedoChangeNotification); +} + +NSString NSUndoManagerDidUndoChangeNotification () +{ + if (NSUndoManagerDidUndoChangeNotification_) + return NSUndoManagerDidUndoChangeNotification_; + + return NSUndoManagerDidUndoChangeNotification_ = new NSString(bindings.NSUndoManagerDidUndoChangeNotification); +} + +NSString NSUndoManagerDidRedoChangeNotification () +{ + if (NSUndoManagerDidRedoChangeNotification_) + return NSUndoManagerDidRedoChangeNotification_; + + return NSUndoManagerDidRedoChangeNotification_ = new NSString(bindings.NSUndoManagerDidRedoChangeNotification); +} + +NSString NSUndoManagerDidOpenUndoGroupNotification () +{ + if (NSUndoManagerDidOpenUndoGroupNotification_) + return NSUndoManagerDidOpenUndoGroupNotification_; + + return NSUndoManagerDidOpenUndoGroupNotification_ = new NSString(bindings.NSUndoManagerDidOpenUndoGroupNotification); +} + +NSString NSUndoManagerWillCloseUndoGroupNotification () +{ + if (NSUndoManagerWillCloseUndoGroupNotification_) + return NSUndoManagerWillCloseUndoGroupNotification_; + + return NSUndoManagerWillCloseUndoGroupNotification_ = new NSString(bindings.NSUndoManagerWillCloseUndoGroupNotification); +} enum { NSUndoCloseGroupingRunLoopOrdering = 350000 } -static this () -{ - NSUndoManagerCheckpointNotification = new NSString(bindings.NSUndoManagerCheckpointNotification); - NSUndoManagerWillUndoChangeNotification = new NSString(bindings.NSUndoManagerWillUndoChangeNotification); - NSUndoManagerWillRedoChangeNotification = new NSString(bindings.NSUndoManagerWillRedoChangeNotification); - NSUndoManagerDidUndoChangeNotification = new NSString(bindings.NSUndoManagerDidUndoChangeNotification); - NSUndoManagerDidRedoChangeNotification = new NSString(bindings.NSUndoManagerDidRedoChangeNotification); - NSUndoManagerDidOpenUndoGroupNotification = new NSString(bindings.NSUndoManagerDidOpenUndoGroupNotification); - NSUndoManagerWillCloseUndoGroupNotification = new NSString(bindings.NSUndoManagerWillCloseUndoGroupNotification); -} - class NSUndoManager : NSObject { - mixin ObjcWrap; - + mixin (ObjcWrap); + + this () + { + super(typeof(this).alloc.init.objcObject); + } + + typeof(this) init () + { + return invokeObjcSelf!(typeof(this), "init"); + } + void beginUndoGrouping () { return invokeObjcSelf!(void, "beginUndoGrouping");