Mercurial > projects > dstep
comparison 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 |
comparison
equal
deleted
inserted
replaced
13:4f583f7e242e | 14:89f3c3ef1fd2 |
---|---|
1 /** | |
2 * Copyright: Copyright (c) 2009 Jacob Carlborg. | |
3 * Authors: Jacob Carlborg | |
4 * Version: Initial created: Aug 3, 2009 | |
5 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) | |
6 */ | |
7 module dstep.foundation.NSUndoManager; | |
8 | |
9 import dstep.foundation.NSArray; | |
10 import dstep.foundation.NSObject; | |
11 import dstep.foundation.NSString; | |
12 import dstep.objc.bridge.Bridge; | |
13 import dstep.objc.objc : id; | |
14 | |
15 import bindings = dstep.foundation.NSUndoManager_bindings; | |
16 | |
17 const NSString NSUndoManagerCheckpointNotification; | |
18 const NSString NSUndoManagerWillUndoChangeNotification; | |
19 const NSString NSUndoManagerWillRedoChangeNotification; | |
20 const NSString NSUndoManagerDidUndoChangeNotification; | |
21 const NSString NSUndoManagerDidRedoChangeNotification; | |
22 const NSString NSUndoManagerDidOpenUndoGroupNotification; | |
23 const NSString NSUndoManagerWillCloseUndoGroupNotification; | |
24 | |
25 enum | |
26 { | |
27 NSUndoCloseGroupingRunLoopOrdering = 350000 | |
28 } | |
29 | |
30 static this () | |
31 { | |
32 NSUndoManagerCheckpointNotification = new NSString(bindings.NSUndoManagerCheckpointNotification); | |
33 NSUndoManagerWillUndoChangeNotification = new NSString(bindings.NSUndoManagerWillUndoChangeNotification); | |
34 NSUndoManagerWillRedoChangeNotification = new NSString(bindings.NSUndoManagerWillRedoChangeNotification); | |
35 NSUndoManagerDidUndoChangeNotification = new NSString(bindings.NSUndoManagerDidUndoChangeNotification); | |
36 NSUndoManagerDidRedoChangeNotification = new NSString(bindings.NSUndoManagerDidRedoChangeNotification); | |
37 NSUndoManagerDidOpenUndoGroupNotification = new NSString(bindings.NSUndoManagerDidOpenUndoGroupNotification); | |
38 NSUndoManagerWillCloseUndoGroupNotification = new NSString(bindings.NSUndoManagerWillCloseUndoGroupNotification); | |
39 } | |
40 | |
41 class NSUndoManager : NSObject | |
42 { | |
43 mixin ObjcWrap; | |
44 | |
45 void beginUndoGrouping () | |
46 { | |
47 return invokeObjcSelf!(void, "beginUndoGrouping"); | |
48 } | |
49 | |
50 void endUndoGrouping () | |
51 { | |
52 return invokeObjcSelf!(void, "endUndoGrouping"); | |
53 } | |
54 | |
55 NSInteger groupingLevel () | |
56 { | |
57 return invokeObjcSelf!(NSInteger, "groupingLevel"); | |
58 } | |
59 | |
60 void disableUndoRegistration () | |
61 { | |
62 return invokeObjcSelf!(void, "disableUndoRegistration"); | |
63 } | |
64 | |
65 void enableUndoRegistration () | |
66 { | |
67 return invokeObjcSelf!(void, "enableUndoRegistration"); | |
68 } | |
69 | |
70 bool isUndoRegistrationEnabled () | |
71 { | |
72 return invokeObjcSelf!(bool, "isUndoRegistrationEnabled"); | |
73 } | |
74 | |
75 bool groupsByEvent () | |
76 { | |
77 return invokeObjcSelf!(bool, "groupsByEvent"); | |
78 } | |
79 | |
80 void setGroupsByEvent (bool groupsByEvent) | |
81 { | |
82 return invokeObjcSelf!(void, "setGroupsByEvent:", bool)(groupsByEvent); | |
83 } | |
84 | |
85 void setLevelsOfUndo (NSUInteger levels) | |
86 { | |
87 return invokeObjcSelf!(void, "setLevelsOfUndo:", NSUInteger)(levels); | |
88 } | |
89 | |
90 NSUInteger levelsOfUndo () | |
91 { | |
92 return invokeObjcSelf!(NSUInteger, "levelsOfUndo"); | |
93 } | |
94 | |
95 void setRunLoopModes (NSArray runLoopModes) | |
96 { | |
97 return invokeObjcSelf!(void, "setRunLoopModes:", NSArray)(runLoopModes); | |
98 } | |
99 | |
100 NSArray runLoopModes () | |
101 { | |
102 return invokeObjcSelf!(NSArray, "runLoopModes"); | |
103 } | |
104 | |
105 void undo () | |
106 { | |
107 return invokeObjcSelf!(void, "undo"); | |
108 } | |
109 | |
110 void redo () | |
111 { | |
112 return invokeObjcSelf!(void, "redo"); | |
113 } | |
114 | |
115 void undoNestedGroup () | |
116 { | |
117 return invokeObjcSelf!(void, "undoNestedGroup"); | |
118 } | |
119 | |
120 bool canUndo () | |
121 { | |
122 return invokeObjcSelf!(bool, "canUndo"); | |
123 } | |
124 | |
125 bool canRedo () | |
126 { | |
127 return invokeObjcSelf!(bool, "canRedo"); | |
128 } | |
129 | |
130 bool isUndoing () | |
131 { | |
132 return invokeObjcSelf!(bool, "isUndoing"); | |
133 } | |
134 | |
135 bool isRedoing () | |
136 { | |
137 return invokeObjcSelf!(bool, "isRedoing"); | |
138 } | |
139 | |
140 void removeAllActions () | |
141 { | |
142 return invokeObjcSelf!(void, "removeAllActions"); | |
143 } | |
144 | |
145 void removeAllActionsWithTarget (Object target) | |
146 { | |
147 return invokeObjcSelf!(void, "removeAllActionsWithTarget:", Object)(target); | |
148 } | |
149 | |
150 void registerUndoWithTarget (Object target, SEL selector, Object anObject) | |
151 { | |
152 return invokeObjcSelf!(void, "registerUndoWithTarget:selector:object:", Object, SEL, Object)(target, selector, anObject); | |
153 } | |
154 | |
155 Object prepareWithInvocationTarget (Object target) | |
156 { | |
157 return invokeObjcSelf!(Object, "prepareWithInvocationTarget:", Object)(target); | |
158 } | |
159 | |
160 NSString undoActionName () | |
161 { | |
162 return invokeObjcSelf!(NSString, "undoActionName"); | |
163 } | |
164 | |
165 NSString redoActionName () | |
166 { | |
167 return invokeObjcSelf!(NSString, "redoActionName"); | |
168 } | |
169 | |
170 void setActionName (NSString actionName) | |
171 { | |
172 return invokeObjcSelf!(void, "setActionName:", NSString)(actionName); | |
173 } | |
174 | |
175 NSString undoMenuItemTitle () | |
176 { | |
177 return invokeObjcSelf!(NSString, "undoMenuItemTitle"); | |
178 } | |
179 | |
180 NSString redoMenuItemTitle () | |
181 { | |
182 return invokeObjcSelf!(NSString, "redoMenuItemTitle"); | |
183 } | |
184 | |
185 NSString undoMenuTitleForUndoActionName (NSString actionName) | |
186 { | |
187 return invokeObjcSelf!(NSString, "undoMenuTitleForUndoActionName:", NSString)(actionName); | |
188 } | |
189 | |
190 NSString redoMenuTitleForUndoActionName (NSString actionName) | |
191 { | |
192 return invokeObjcSelf!(NSString, "redoMenuTitleForUndoActionName:", NSString)(actionName); | |
193 } | |
194 } | |
195 |