diff dstep/foundation/NSUndoManager.d @ 14:89f3c3ef1fd2

Added the Foundation framework
author Jacob Carlborg <doob@me.com>
date Mon, 03 Aug 2009 15:23:15 +0200
parents
children 19885b43130e
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dstep/foundation/NSUndoManager.d	Mon Aug 03 15:23:15 2009 +0200
@@ -0,0 +1,195 @@
+/**
+ * Copyright: Copyright (c) 2009 Jacob Carlborg.
+ * Authors: Jacob Carlborg
+ * Version: Initial created: Aug 3, 2009 
+ * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0)
+ */
+module dstep.foundation.NSUndoManager;
+
+import dstep.foundation.NSArray;
+import dstep.foundation.NSObject;
+import dstep.foundation.NSString;
+import dstep.objc.bridge.Bridge;
+import dstep.objc.objc : id;
+
+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;
+
+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;
+
+	void beginUndoGrouping ()
+	{
+		return invokeObjcSelf!(void, "beginUndoGrouping");
+	}
+
+	void endUndoGrouping ()
+	{
+		return invokeObjcSelf!(void, "endUndoGrouping");
+	}
+
+	NSInteger groupingLevel ()
+	{
+		return invokeObjcSelf!(NSInteger, "groupingLevel");
+	}
+
+	void disableUndoRegistration ()
+	{
+		return invokeObjcSelf!(void, "disableUndoRegistration");
+	}
+
+	void enableUndoRegistration ()
+	{
+		return invokeObjcSelf!(void, "enableUndoRegistration");
+	}
+
+	bool isUndoRegistrationEnabled ()
+	{
+		return invokeObjcSelf!(bool, "isUndoRegistrationEnabled");
+	}
+
+	bool groupsByEvent ()
+	{
+		return invokeObjcSelf!(bool, "groupsByEvent");
+	}
+
+	void setGroupsByEvent (bool groupsByEvent)
+	{
+		return invokeObjcSelf!(void, "setGroupsByEvent:", bool)(groupsByEvent);
+	}
+
+	void setLevelsOfUndo (NSUInteger levels)
+	{
+		return invokeObjcSelf!(void, "setLevelsOfUndo:", NSUInteger)(levels);
+	}
+
+	NSUInteger levelsOfUndo ()
+	{
+		return invokeObjcSelf!(NSUInteger, "levelsOfUndo");
+	}
+
+	void setRunLoopModes (NSArray runLoopModes)
+	{
+		return invokeObjcSelf!(void, "setRunLoopModes:", NSArray)(runLoopModes);
+	}
+
+	NSArray runLoopModes ()
+	{
+		return invokeObjcSelf!(NSArray, "runLoopModes");
+	}
+
+	void undo ()
+	{
+		return invokeObjcSelf!(void, "undo");
+	}
+
+	void redo ()
+	{
+		return invokeObjcSelf!(void, "redo");
+	}
+
+	void undoNestedGroup ()
+	{
+		return invokeObjcSelf!(void, "undoNestedGroup");
+	}
+
+	bool canUndo ()
+	{
+		return invokeObjcSelf!(bool, "canUndo");
+	}
+
+	bool canRedo ()
+	{
+		return invokeObjcSelf!(bool, "canRedo");
+	}
+
+	bool isUndoing ()
+	{
+		return invokeObjcSelf!(bool, "isUndoing");
+	}
+
+	bool isRedoing ()
+	{
+		return invokeObjcSelf!(bool, "isRedoing");
+	}
+
+	void removeAllActions ()
+	{
+		return invokeObjcSelf!(void, "removeAllActions");
+	}
+
+	void removeAllActionsWithTarget (Object target)
+	{
+		return invokeObjcSelf!(void, "removeAllActionsWithTarget:", Object)(target);
+	}
+
+	void registerUndoWithTarget (Object target, SEL selector, Object anObject)
+	{
+		return invokeObjcSelf!(void, "registerUndoWithTarget:selector:object:", Object, SEL, Object)(target, selector, anObject);
+	}
+
+	Object prepareWithInvocationTarget (Object target)
+	{
+		return invokeObjcSelf!(Object, "prepareWithInvocationTarget:", Object)(target);
+	}
+
+	NSString undoActionName ()
+	{
+		return invokeObjcSelf!(NSString, "undoActionName");
+	}
+
+	NSString redoActionName ()
+	{
+		return invokeObjcSelf!(NSString, "redoActionName");
+	}
+
+	void setActionName (NSString actionName)
+	{
+		return invokeObjcSelf!(void, "setActionName:", NSString)(actionName);
+	}
+
+	NSString undoMenuItemTitle ()
+	{
+		return invokeObjcSelf!(NSString, "undoMenuItemTitle");
+	}
+
+	NSString redoMenuItemTitle ()
+	{
+		return invokeObjcSelf!(NSString, "redoMenuItemTitle");
+	}
+
+	NSString undoMenuTitleForUndoActionName (NSString actionName)
+	{
+		return invokeObjcSelf!(NSString, "undoMenuTitleForUndoActionName:", NSString)(actionName);
+	}
+
+	NSString redoMenuTitleForUndoActionName (NSString actionName)
+	{
+		return invokeObjcSelf!(NSString, "redoMenuTitleForUndoActionName:", NSString)(actionName);
+	}
+}
+