comparison dstep/appkit/NSTextStorage.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
comparison
equal deleted inserted replaced
15:7ff919f595d5 16:19885b43130e
1 /**
2 * Copyright: Copyright (c) 2009 Jacob Carlborg.
3 * Authors: Jacob Carlborg
4 * Version: Initial created: Sep 24, 2009
5 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0)
6 */
7 module dstep.appkit.NSTextStorage;
8
9 import dstep.appkit.NSAttributedString;
10 import dstep.appkit.NSColor;
11 import dstep.appkit.NSFont;
12 import dstep.appkit.NSLayoutManager;
13 import dstep.appkit.NSTextStorageScripting;
14 import dstep.foundation.NSArray;
15 import dstep.foundation.NSAttributedString;
16 import dstep.foundation.NSObjCRuntime;
17 import dstep.foundation.NSObject;
18 import dstep.foundation.NSRange;
19 import dstep.foundation.NSString;
20 import dstep.objc.bridge.Bridge;
21 import dstep.objc.objc;
22
23 import bindings = dstep.appkit.NSTextStorage_bindings;
24
25 private
26 {
27 NSString NSTextStorageWillProcessEditingNotification_;
28 NSString NSTextStorageDidProcessEditingNotification_;
29 }
30
31 NSString NSTextStorageWillProcessEditingNotification ()
32 {
33 if (NSTextStorageWillProcessEditingNotification_)
34 return NSTextStorageWillProcessEditingNotification_;
35
36 return NSTextStorageWillProcessEditingNotification_ = new NSString(bindings.NSTextStorageWillProcessEditingNotification);
37 }
38
39 NSString NSTextStorageDidProcessEditingNotification ()
40 {
41 if (NSTextStorageDidProcessEditingNotification_)
42 return NSTextStorageDidProcessEditingNotification_;
43
44 return NSTextStorageDidProcessEditingNotification_ = new NSString(bindings.NSTextStorageDidProcessEditingNotification);
45 }
46
47 enum
48 {
49 NSTextStorageEditedAttributes = 1,
50 NSTextStorageEditedCharacters = 2
51 }
52
53 const TNSTextStorageDelegate = `
54
55 void textStorageWillProcessEditing (NSNotification notification)
56 {
57 return invokeObjcSelf!(void, "textStorageWillProcessEditing:", NSNotification)(notification);
58 }
59
60 void textStorageDidProcessEditing (NSNotification notification)
61 {
62 return invokeObjcSelf!(void, "textStorageDidProcessEditing:", NSNotification)(notification);
63 }
64
65 //mixin ObjcBindMethod!(textStorageWillProcessEditing, "textStorageWillProcessEditing:");
66 //mixin ObjcBindMethod!(textStorageDidProcessEditing, "textStorageDidProcessEditing:");
67
68 `;
69
70 class NSTextStorage : NSMutableAttributedString
71 {
72 mixin (ObjcWrap);
73
74 void addLayoutManager (NSLayoutManager obj)
75 {
76 return invokeObjcSelf!(void, "addLayoutManager:", NSLayoutManager)(obj);
77 }
78
79 void removeLayoutManager (NSLayoutManager obj)
80 {
81 return invokeObjcSelf!(void, "removeLayoutManager:", NSLayoutManager)(obj);
82 }
83
84 NSArray layoutManagers ()
85 {
86 return invokeObjcSelf!(NSArray, "layoutManagers");
87 }
88
89 void edited (NSUInteger editedMask, NSRange range, NSInteger delta)
90 {
91 return invokeObjcSelf!(void, "edited:range:changeInLength:", NSUInteger, NSRange, NSInteger)(editedMask, range, delta);
92 }
93
94 void processEditing ()
95 {
96 return invokeObjcSelf!(void, "processEditing");
97 }
98
99 void invalidateAttributesInRange (NSRange range)
100 {
101 return invokeObjcSelf!(void, "invalidateAttributesInRange:", NSRange)(range);
102 }
103
104 void ensureAttributesAreFixedInRange (NSRange range)
105 {
106 return invokeObjcSelf!(void, "ensureAttributesAreFixedInRange:", NSRange)(range);
107 }
108
109 bool fixesAttributesLazily ()
110 {
111 return invokeObjcSelf!(bool, "fixesAttributesLazily");
112 }
113
114 NSUInteger editedMask ()
115 {
116 return invokeObjcSelf!(NSUInteger, "editedMask");
117 }
118
119 NSRange editedRange ()
120 {
121 return invokeObjcSelf!(NSRange, "editedRange");
122 }
123
124 NSInteger changeInLength ()
125 {
126 return invokeObjcSelf!(NSInteger, "changeInLength");
127 }
128
129 void setDelegate (Object delegate_)
130 {
131 return invokeObjcSelf!(void, "setDelegate:", Object)(delegate_);
132 }
133
134 Object delegate_ ()
135 {
136 return invokeObjcSelf!(Object, "delegate");
137 }
138
139 // Scripting
140 NSArray attributeRuns ()
141 {
142 return invokeObjcSelf!(NSArray, "attributeRuns");
143 }
144
145 void setAttributeRuns (NSArray attributeRuns)
146 {
147 return invokeObjcSelf!(void, "setAttributeRuns:", NSArray)(attributeRuns);
148 }
149
150 NSArray paragraphs ()
151 {
152 return invokeObjcSelf!(NSArray, "paragraphs");
153 }
154
155 void setParagraphs (NSArray paragraphs)
156 {
157 return invokeObjcSelf!(void, "setParagraphs:", NSArray)(paragraphs);
158 }
159
160 NSArray words ()
161 {
162 return invokeObjcSelf!(NSArray, "words");
163 }
164
165 void setWords (NSArray words)
166 {
167 return invokeObjcSelf!(void, "setWords:", NSArray)(words);
168 }
169
170 NSArray characters ()
171 {
172 return invokeObjcSelf!(NSArray, "characters");
173 }
174
175 void setCharacters (NSArray characters)
176 {
177 return invokeObjcSelf!(void, "setCharacters:", NSArray)(characters);
178 }
179
180 NSFont font ()
181 {
182 return invokeObjcSelf!(NSFont, "font");
183 }
184
185 void setFont (NSFont font)
186 {
187 return invokeObjcSelf!(void, "setFont:", NSFont)(font);
188 }
189
190 NSColor foregroundColor ()
191 {
192 return invokeObjcSelf!(NSColor, "foregroundColor");
193 }
194
195 void setForegroundColor (NSColor color)
196 {
197 return invokeObjcSelf!(void, "setForegroundColor:", NSColor)(color);
198 }
199 }