comparison dstep/appkit/NSParagraphStyle.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.NSParagraphStyle;
8
9 import dstep.appkit.NSText;
10 import dstep.applicationservices.coregraphics.CGBase;
11 import dstep.foundation.NSArray;
12 import dstep.foundation.NSCoder;
13 import dstep.foundation.NSDictionary;
14 import dstep.foundation.NSObjCRuntime;
15 import dstep.foundation.NSObject;
16 import dstep.foundation.NSString;
17 import dstep.foundation.NSZone;
18 import dstep.objc.bridge.Bridge;
19 import dstep.objc.objc;
20
21 import bindings = dstep.appkit.NSParagraphStyle_bindings;
22
23 alias NSUInteger NSTextTabType;
24 alias NSUInteger NSLineBreakMode;
25
26 private
27 {
28 NSString NSTabColumnTerminatorsAttributeName_;
29 }
30
31 NSString NSTabColumnTerminatorsAttributeName ()
32 {
33 if (NSTabColumnTerminatorsAttributeName_)
34 return NSTabColumnTerminatorsAttributeName_;
35
36 return NSTabColumnTerminatorsAttributeName_ = new NSString(bindings.NSTabColumnTerminatorsAttributeName);
37 }
38
39 enum
40 {
41 NSLeftTabStopType = 0,
42 NSRightTabStopType,
43 NSCenterTabStopType,
44 NSDecimalTabStopType
45 }
46
47 enum
48 {
49 NSLineBreakByWordWrapping = 0,
50 NSLineBreakByCharWrapping,
51 NSLineBreakByClipping,
52 NSLineBreakByTruncatingHead,
53 NSLineBreakByTruncatingTail,
54 NSLineBreakByTruncatingMiddle
55 }
56
57 class NSTextTab : NSObject, INSCopying, INSCoding
58 {
59 mixin (ObjcWrap);
60
61 this (NSCoder aDecoder)
62 {
63 super(typeof(this).alloc.initWithCoder(aDecoder).objcObject);
64 }
65
66 void encodeWithCoder (NSCoder aCoder)
67 {
68 return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder);
69 }
70
71 typeof(this) initWithCoder (NSCoder aDecoder)
72 {
73 return invokeObjcSelf!(typeof(this), "initWithCoder:", NSCoder)(aDecoder);
74 }
75
76 typeof(this) copyWithZone (NSZone* zone)
77 {
78 return invokeObjcSelf!(typeof(this), "copyWithZone:", NSZone*)(zone);
79 }
80
81 NSTextTab initWithTextAlignment (uint alignment, CGFloat loc, NSDictionary options)
82 {
83 id result = invokeObjcSelf!(id, "initWithTextAlignment:location:options:", uint, CGFloat, NSDictionary)(alignment, loc, options);
84 return result is this.objcObject ? this : (result !is null ? new NSTextTab(result) : null);
85 }
86
87 this (uint alignment, CGFloat loc, NSDictionary options)
88 {
89 super(NSTextTab.alloc.initWithTextAlignment(alignment, loc, options).objcObject);
90 }
91
92 uint alignment ()
93 {
94 return invokeObjcSelf!(uint, "alignment");
95 }
96
97 NSDictionary options ()
98 {
99 return invokeObjcSelf!(NSDictionary, "options");
100 }
101
102 NSTextTab initWithType (uint type, CGFloat loc)
103 {
104 id result = invokeObjcSelf!(id, "initWithType:location:", uint, CGFloat)(type, loc);
105 return result is this.objcObject ? this : (result !is null ? new NSTextTab(result) : null);
106 }
107
108 this (uint type, CGFloat loc)
109 {
110 super(NSTextTab.alloc.initWithType(type, loc).objcObject);
111 }
112
113 CGFloat location ()
114 {
115 return invokeObjcSelf!(CGFloat, "location");
116 }
117
118 uint tabStopType ()
119 {
120 return invokeObjcSelf!(uint, "tabStopType");
121 }
122
123 }
124
125 class NSMutableParagraphStyle : NSParagraphStyle
126 {
127 mixin (ObjcWrap);
128
129 void setLineSpacing (CGFloat aFloat)
130 {
131 return invokeObjcSelf!(void, "setLineSpacing:", CGFloat)(aFloat);
132 }
133
134 void setParagraphSpacing (CGFloat aFloat)
135 {
136 return invokeObjcSelf!(void, "setParagraphSpacing:", CGFloat)(aFloat);
137 }
138
139 void setAlignment (uint alignment)
140 {
141 return invokeObjcSelf!(void, "setAlignment:", uint)(alignment);
142 }
143
144 void setFirstLineHeadIndent (CGFloat aFloat)
145 {
146 return invokeObjcSelf!(void, "setFirstLineHeadIndent:", CGFloat)(aFloat);
147 }
148
149 void setHeadIndent (CGFloat aFloat)
150 {
151 return invokeObjcSelf!(void, "setHeadIndent:", CGFloat)(aFloat);
152 }
153
154 void setTailIndent (CGFloat aFloat)
155 {
156 return invokeObjcSelf!(void, "setTailIndent:", CGFloat)(aFloat);
157 }
158
159 void setLineBreakMode (uint mode)
160 {
161 return invokeObjcSelf!(void, "setLineBreakMode:", uint)(mode);
162 }
163
164 void setMinimumLineHeight (CGFloat aFloat)
165 {
166 return invokeObjcSelf!(void, "setMinimumLineHeight:", CGFloat)(aFloat);
167 }
168
169 void setMaximumLineHeight (CGFloat aFloat)
170 {
171 return invokeObjcSelf!(void, "setMaximumLineHeight:", CGFloat)(aFloat);
172 }
173
174 void addTabStop (NSTextTab anObject)
175 {
176 return invokeObjcSelf!(void, "addTabStop:", NSTextTab)(anObject);
177 }
178
179 void removeTabStop (NSTextTab anObject)
180 {
181 return invokeObjcSelf!(void, "removeTabStop:", NSTextTab)(anObject);
182 }
183
184 void setTabStops (NSArray array)
185 {
186 return invokeObjcSelf!(void, "setTabStops:", NSArray)(array);
187 }
188
189 void setParagraphStyle (NSParagraphStyle obj)
190 {
191 return invokeObjcSelf!(void, "setParagraphStyle:", NSParagraphStyle)(obj);
192 }
193
194 void setBaseWritingDirection (int writingDirection)
195 {
196 return invokeObjcSelf!(void, "setBaseWritingDirection:", int)(writingDirection);
197 }
198
199 void setLineHeightMultiple (CGFloat aFloat)
200 {
201 return invokeObjcSelf!(void, "setLineHeightMultiple:", CGFloat)(aFloat);
202 }
203
204 void setParagraphSpacingBefore (CGFloat aFloat)
205 {
206 return invokeObjcSelf!(void, "setParagraphSpacingBefore:", CGFloat)(aFloat);
207 }
208
209 void setDefaultTabInterval (CGFloat aFloat)
210 {
211 return invokeObjcSelf!(void, "setDefaultTabInterval:", CGFloat)(aFloat);
212 }
213
214 void setTextBlocks (NSArray array)
215 {
216 return invokeObjcSelf!(void, "setTextBlocks:", NSArray)(array);
217 }
218
219 void setTextLists (NSArray array)
220 {
221 return invokeObjcSelf!(void, "setTextLists:", NSArray)(array);
222 }
223
224 void setHyphenationFactor (float aFactor)
225 {
226 return invokeObjcSelf!(void, "setHyphenationFactor:", float)(aFactor);
227 }
228
229 void setTighteningFactorForTruncation (float aFactor)
230 {
231 return invokeObjcSelf!(void, "setTighteningFactorForTruncation:", float)(aFactor);
232 }
233
234 void setHeaderLevel (NSInteger level)
235 {
236 return invokeObjcSelf!(void, "setHeaderLevel:", NSInteger)(level);
237 }
238 }
239
240 class NSParagraphStyle : NSObject, INSCopying, INSMutableCopying, INSCoding
241 {
242 mixin (ObjcWrap);
243
244 NSParagraphStyle mutableCopyWithZone (NSZone* aZone)
245 {
246 return invokeObjcSelf!(NSParagraphStyle, "mutableCopyWithZone:", NSZone*)(aZone);
247 }
248
249 this (NSCoder aDecoder)
250 {
251 super(typeof(this).alloc.initWithCoder(aDecoder).objcObject);
252 }
253
254 void encodeWithCoder (NSCoder aCoder)
255 {
256 return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder);
257 }
258
259 typeof(this) initWithCoder (NSCoder aDecoder)
260 {
261 return invokeObjcSelf!(typeof(this), "initWithCoder:", NSCoder)(aDecoder);
262 }
263
264 typeof(this) copyWithZone (NSZone* zone)
265 {
266 return invokeObjcSelf!(typeof(this), "copyWithZone:", NSZone*)(zone);
267 }
268
269 static NSParagraphStyle defaultParagraphStyle ()
270 {
271 return invokeObjcSelfClass!(NSParagraphStyle, "defaultParagraphStyle");
272 }
273
274 static int defaultWritingDirectionForLanguage (NSString languageName)
275 {
276 return invokeObjcSelfClass!(int, "defaultWritingDirectionForLanguage:", NSString)(languageName);
277 }
278
279 CGFloat lineSpacing ()
280 {
281 return invokeObjcSelf!(CGFloat, "lineSpacing");
282 }
283
284 CGFloat paragraphSpacing ()
285 {
286 return invokeObjcSelf!(CGFloat, "paragraphSpacing");
287 }
288
289 uint alignment ()
290 {
291 return invokeObjcSelf!(uint, "alignment");
292 }
293
294 CGFloat headIndent ()
295 {
296 return invokeObjcSelf!(CGFloat, "headIndent");
297 }
298
299 CGFloat tailIndent ()
300 {
301 return invokeObjcSelf!(CGFloat, "tailIndent");
302 }
303
304 CGFloat firstLineHeadIndent ()
305 {
306 return invokeObjcSelf!(CGFloat, "firstLineHeadIndent");
307 }
308
309 NSArray tabStops ()
310 {
311 return invokeObjcSelf!(NSArray, "tabStops");
312 }
313
314 CGFloat minimumLineHeight ()
315 {
316 return invokeObjcSelf!(CGFloat, "minimumLineHeight");
317 }
318
319 CGFloat maximumLineHeight ()
320 {
321 return invokeObjcSelf!(CGFloat, "maximumLineHeight");
322 }
323
324 uint lineBreakMode ()
325 {
326 return invokeObjcSelf!(uint, "lineBreakMode");
327 }
328
329 int baseWritingDirection ()
330 {
331 return invokeObjcSelf!(int, "baseWritingDirection");
332 }
333
334 CGFloat lineHeightMultiple ()
335 {
336 return invokeObjcSelf!(CGFloat, "lineHeightMultiple");
337 }
338
339 CGFloat paragraphSpacingBefore ()
340 {
341 return invokeObjcSelf!(CGFloat, "paragraphSpacingBefore");
342 }
343
344 CGFloat defaultTabInterval ()
345 {
346 return invokeObjcSelf!(CGFloat, "defaultTabInterval");
347 }
348
349 NSArray textBlocks ()
350 {
351 return invokeObjcSelf!(NSArray, "textBlocks");
352 }
353
354 NSArray textLists ()
355 {
356 return invokeObjcSelf!(NSArray, "textLists");
357 }
358
359 float hyphenationFactor ()
360 {
361 return invokeObjcSelf!(float, "hyphenationFactor");
362 }
363
364 float tighteningFactorForTruncation ()
365 {
366 return invokeObjcSelf!(float, "tighteningFactorForTruncation");
367 }
368
369 NSInteger headerLevel ()
370 {
371 return invokeObjcSelf!(NSInteger, "headerLevel");
372 }
373
374 }
375