comparison 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
comparison
equal deleted inserted replaced
15:7ff919f595d5 16:19885b43130e
5 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) 5 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0)
6 */ 6 */
7 module dstep.foundation.NSUndoManager; 7 module dstep.foundation.NSUndoManager;
8 8
9 import dstep.foundation.NSArray; 9 import dstep.foundation.NSArray;
10 import dstep.foundation.NSObjCRuntime;
10 import dstep.foundation.NSObject; 11 import dstep.foundation.NSObject;
11 import dstep.foundation.NSString; 12 import dstep.foundation.NSString;
12 import dstep.objc.bridge.Bridge; 13 import dstep.objc.bridge.Bridge;
13 import dstep.objc.objc : id; 14 import dstep.objc.objc;
15
16
14 17
15 import bindings = dstep.foundation.NSUndoManager_bindings; 18 import bindings = dstep.foundation.NSUndoManager_bindings;
16 19
17 const NSString NSUndoManagerCheckpointNotification; 20 private
18 const NSString NSUndoManagerWillUndoChangeNotification; 21 {
19 const NSString NSUndoManagerWillRedoChangeNotification; 22 NSString NSUndoManagerCheckpointNotification_;
20 const NSString NSUndoManagerDidUndoChangeNotification; 23 NSString NSUndoManagerWillUndoChangeNotification_;
21 const NSString NSUndoManagerDidRedoChangeNotification; 24 NSString NSUndoManagerWillRedoChangeNotification_;
22 const NSString NSUndoManagerDidOpenUndoGroupNotification; 25 NSString NSUndoManagerDidUndoChangeNotification_;
23 const NSString NSUndoManagerWillCloseUndoGroupNotification; 26 NSString NSUndoManagerDidRedoChangeNotification_;
27 NSString NSUndoManagerDidOpenUndoGroupNotification_;
28 NSString NSUndoManagerWillCloseUndoGroupNotification_;
29 }
30
31 NSString NSUndoManagerCheckpointNotification ()
32 {
33 if (NSUndoManagerCheckpointNotification_)
34 return NSUndoManagerCheckpointNotification_;
35
36 return NSUndoManagerCheckpointNotification_ = new NSString(bindings.NSUndoManagerCheckpointNotification);
37 }
38
39 NSString NSUndoManagerWillUndoChangeNotification ()
40 {
41 if (NSUndoManagerWillUndoChangeNotification_)
42 return NSUndoManagerWillUndoChangeNotification_;
43
44 return NSUndoManagerWillUndoChangeNotification_ = new NSString(bindings.NSUndoManagerWillUndoChangeNotification);
45 }
46
47 NSString NSUndoManagerWillRedoChangeNotification ()
48 {
49 if (NSUndoManagerWillRedoChangeNotification_)
50 return NSUndoManagerWillRedoChangeNotification_;
51
52 return NSUndoManagerWillRedoChangeNotification_ = new NSString(bindings.NSUndoManagerWillRedoChangeNotification);
53 }
54
55 NSString NSUndoManagerDidUndoChangeNotification ()
56 {
57 if (NSUndoManagerDidUndoChangeNotification_)
58 return NSUndoManagerDidUndoChangeNotification_;
59
60 return NSUndoManagerDidUndoChangeNotification_ = new NSString(bindings.NSUndoManagerDidUndoChangeNotification);
61 }
62
63 NSString NSUndoManagerDidRedoChangeNotification ()
64 {
65 if (NSUndoManagerDidRedoChangeNotification_)
66 return NSUndoManagerDidRedoChangeNotification_;
67
68 return NSUndoManagerDidRedoChangeNotification_ = new NSString(bindings.NSUndoManagerDidRedoChangeNotification);
69 }
70
71 NSString NSUndoManagerDidOpenUndoGroupNotification ()
72 {
73 if (NSUndoManagerDidOpenUndoGroupNotification_)
74 return NSUndoManagerDidOpenUndoGroupNotification_;
75
76 return NSUndoManagerDidOpenUndoGroupNotification_ = new NSString(bindings.NSUndoManagerDidOpenUndoGroupNotification);
77 }
78
79 NSString NSUndoManagerWillCloseUndoGroupNotification ()
80 {
81 if (NSUndoManagerWillCloseUndoGroupNotification_)
82 return NSUndoManagerWillCloseUndoGroupNotification_;
83
84 return NSUndoManagerWillCloseUndoGroupNotification_ = new NSString(bindings.NSUndoManagerWillCloseUndoGroupNotification);
85 }
24 86
25 enum 87 enum
26 { 88 {
27 NSUndoCloseGroupingRunLoopOrdering = 350000 89 NSUndoCloseGroupingRunLoopOrdering = 350000
28 } 90 }
29 91
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 92 class NSUndoManager : NSObject
42 { 93 {
43 mixin ObjcWrap; 94 mixin (ObjcWrap);
44 95
96 this ()
97 {
98 super(typeof(this).alloc.init.objcObject);
99 }
100
101 typeof(this) init ()
102 {
103 return invokeObjcSelf!(typeof(this), "init");
104 }
105
45 void beginUndoGrouping () 106 void beginUndoGrouping ()
46 { 107 {
47 return invokeObjcSelf!(void, "beginUndoGrouping"); 108 return invokeObjcSelf!(void, "beginUndoGrouping");
48 } 109 }
49 110