comparison dstep/appkit/NSLayoutManager.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 f8a3b67adfcb
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.NSLayoutManager;
8
9 import dstep.appkit.NSBox;
10 import dstep.appkit.NSCell;
11 import dstep.appkit.NSColor;
12 import dstep.appkit.NSEvent;
13 import dstep.appkit.NSFont;
14 import dstep.appkit.NSGlyphGenerator;
15 import dstep.appkit.NSImageCell;
16 import dstep.appkit.NSMatrix;
17 import dstep.appkit.NSParagraphStyle;
18 import dstep.appkit.NSRulerMarker;
19 import dstep.appkit.NSRulerView;
20 import dstep.appkit.NSTextContainer;
21 import dstep.appkit.NSTextField;
22 import dstep.appkit.NSTextStorage;
23 import dstep.appkit.NSTextTable;
24 import dstep.appkit.NSTextView;
25 import dstep.appkit.NSTypesetter;
26 import dstep.appkit.NSView;
27 import dstep.appkit.NSWindow;
28 import dstep.applicationservices.coregraphics.CGBase;
29 import dstep.foundation.NSArray;
30 import dstep.foundation.NSAttributedString;
31 import dstep.foundation.NSCoder;
32 import dstep.foundation.NSDictionary;
33 import dstep.foundation.NSGeometry;
34 import dstep.foundation.NSObjCRuntime;
35 import dstep.foundation.NSObject;
36 import dstep.foundation.NSRange;
37 import dstep.foundation.NSString;
38 import dstep.foundation.NSZone;
39 import dstep.objc.bridge.Bridge;
40 import dstep.objc.objc;
41
42 alias NSUInteger NSGlyphInscription;
43 alias NSInteger NSTypesetterBehavior;
44
45 enum
46 {
47 NSGlyphAttributeSoft = 0,
48 NSGlyphAttributeElastic = 1,
49 NSGlyphAttributeBidiLevel = 2,
50 NSGlyphAttributeInscribe = 5
51 }
52
53 enum
54 {
55 NSGlyphInscribeBase = 0,
56 NSGlyphInscribeBelow = 1,
57 NSGlyphInscribeAbove = 2,
58 NSGlyphInscribeOverstrike = 3,
59 NSGlyphInscribeOverBelow = 4
60 }
61
62 enum
63 {
64 NSTypesetterLatestBehavior = -1,
65 NSTypesetterOriginalBehavior = 0,
66 NSTypesetterBehavior_10_2_WithCompatibility = 1,
67 NSTypesetterBehavior_10_2 = 2,
68 NSTypesetterBehavior_10_3 = 3,
69 NSTypesetterBehavior_10_4 = 4
70 }
71
72 const TNSTextViewSupport = `
73
74 NSArray rulerMarkersForTextView (NSTextView view, NSParagraphStyle style, NSRulerView ruler)
75 {
76 return invokeObjcSelf!(NSArray, "rulerMarkersForTextView:paragraphStyle:ruler:", NSTextView, NSParagraphStyle, NSRulerView)(view, style, ruler);
77 }
78
79 NSView rulerAccessoryViewForTextView (NSTextView view, NSParagraphStyle style, NSRulerView ruler, bool isEnabled)
80 {
81 return invokeObjcSelf!(NSView, "rulerAccessoryViewForTextView:paragraphStyle:ruler:enabled:", NSTextView, NSParagraphStyle, NSRulerView, bool)(view, style, ruler, isEnabled);
82 }
83
84 bool layoutManagerOwnsFirstResponderInWindow (NSWindow window)
85 {
86 return invokeObjcSelf!(bool, "layoutManagerOwnsFirstResponderInWindow:", NSWindow)(window);
87 }
88
89 NSTextView firstTextView ()
90 {
91 return invokeObjcSelf!(NSTextView, "firstTextView");
92 }
93
94 NSTextView textViewForBeginningOfSelection ()
95 {
96 return invokeObjcSelf!(NSTextView, "textViewForBeginningOfSelection");
97 }
98
99 void drawBackgroundForGlyphRange (NSRange glyphsToShow, NSPoint origin)
100 {
101 return invokeObjcSelf!(void, "drawBackgroundForGlyphRange:atPoint:", NSRange, NSPoint)(glyphsToShow, origin);
102 }
103
104 void drawGlyphsForGlyphRange (NSRange glyphsToShow, NSPoint origin)
105 {
106 return invokeObjcSelf!(void, "drawGlyphsForGlyphRange:atPoint:", NSRange, NSPoint)(glyphsToShow, origin);
107 }
108
109 void showPackedGlyphs (char* glyphs, NSUInteger glyphLen, NSRange glyphRange, NSPoint point, NSFont font, NSColor color, NSSize printingAdjustment)
110 {
111 return invokeObjcSelf!(void, "showPackedGlyphs:length:glyphRange:atPoint:font:color:printingAdjustment:", char*, NSUInteger, NSRange, NSPoint, NSFont, NSColor, NSSize)(glyphs, glyphLen, glyphRange, point, font, color, printingAdjustment);
112 }
113
114 void showAttachmentCell (NSCell cell, NSRect rect, NSUInteger attachmentIndex)
115 {
116 return invokeObjcSelf!(void, "showAttachmentCell:inRect:characterIndex:", NSCell, NSRect, NSUInteger)(cell, rect, attachmentIndex);
117 }
118
119 void drawUnderlineForGlyphRange (NSRange glyphRange, NSInteger underlineVal, CGFloat baselineOffset, NSRect lineRect, NSRange lineGlyphRange, NSPoint containerOrigin)
120 {
121 return invokeObjcSelf!(void, "drawUnderlineForGlyphRange:underlineType:baselineOffset:lineFragmentRect:lineFragmentGlyphRange:containerOrigin:", NSRange, NSInteger, CGFloat, NSRect, NSRange, NSPoint)(glyphRange, underlineVal, baselineOffset, lineRect, lineGlyphRange, containerOrigin);
122 }
123
124 void underlineGlyphRange (NSRange glyphRange, NSInteger underlineVal, NSRect lineRect, NSRange lineGlyphRange, NSPoint containerOrigin)
125 {
126 return invokeObjcSelf!(void, "underlineGlyphRange:underlineType:lineFragmentRect:lineFragmentGlyphRange:containerOrigin:", NSRange, NSInteger, NSRect, NSRange, NSPoint)(glyphRange, underlineVal, lineRect, lineGlyphRange, containerOrigin);
127 }
128
129 void drawStrikethroughForGlyphRange (NSRange glyphRange, NSInteger strikethroughVal, CGFloat baselineOffset, NSRect lineRect, NSRange lineGlyphRange, NSPoint containerOrigin)
130 {
131 return invokeObjcSelf!(void, "drawStrikethroughForGlyphRange:strikethroughType:baselineOffset:lineFragmentRect:lineFragmentGlyphRange:containerOrigin:", NSRange, NSInteger, CGFloat, NSRect, NSRange, NSPoint)(glyphRange, strikethroughVal, baselineOffset, lineRect, lineGlyphRange, containerOrigin);
132 }
133
134 void strikethroughGlyphRange (NSRange glyphRange, NSInteger strikethroughVal, NSRect lineRect, NSRange lineGlyphRange, NSPoint containerOrigin)
135 {
136 return invokeObjcSelf!(void, "strikethroughGlyphRange:strikethroughType:lineFragmentRect:lineFragmentGlyphRange:containerOrigin:", NSRange, NSInteger, NSRect, NSRange, NSPoint)(glyphRange, strikethroughVal, lineRect, lineGlyphRange, containerOrigin);
137 }
138
139 //mixin ObjcBindMethod!(rulerMarkersForTextView, "rulerMarkersForTextView:paragraphStyle:ruler:");
140 //mixin ObjcBindMethod!(rulerAccessoryViewForTextView, "rulerAccessoryViewForTextView:paragraphStyle:ruler:enabled:");
141 //mixin ObjcBindMethod!(layoutManagerOwnsFirstResponderInWindow, "layoutManagerOwnsFirstResponderInWindow:");
142 //mixin ObjcBindMethod!(firstTextView, "firstTextView");
143 //mixin ObjcBindMethod!(textViewForBeginningOfSelection, "textViewForBeginningOfSelection");
144 //mixin ObjcBindMethod!(drawBackgroundForGlyphRange, "drawBackgroundForGlyphRange:atPoint:");
145 //mixin ObjcBindMethod!(drawGlyphsForGlyphRange, "drawGlyphsForGlyphRange:atPoint:");
146 //mixin ObjcBindMethod!(showPackedGlyphs, "showPackedGlyphs:length:glyphRange:atPoint:font:color:printingAdjustment:");
147 //mixin ObjcBindMethod!(showAttachmentCell, "showAttachmentCell:inRect:characterIndex:");
148 //mixin ObjcBindMethod!(drawUnderlineForGlyphRange, "drawUnderlineForGlyphRange:underlineType:baselineOffset:lineFragmentRect:lineFragmentGlyphRange:containerOrigin:");
149 //mixin ObjcBindMethod!(underlineGlyphRange, "underlineGlyphRange:underlineType:lineFragmentRect:lineFragmentGlyphRange:containerOrigin:");
150 //mixin ObjcBindMethod!(drawStrikethroughForGlyphRange, "drawStrikethroughForGlyphRange:strikethroughType:baselineOffset:lineFragmentRect:lineFragmentGlyphRange:containerOrigin:");
151 //mixin ObjcBindMethod!(strikethroughGlyphRange, "strikethroughGlyphRange:strikethroughType:lineFragmentRect:lineFragmentGlyphRange:containerOrigin:");
152
153 `;
154
155 const TNSLayoutManagerDelegate = `
156
157 void layoutManagerDidInvalidateLayout (NSLayoutManager sender)
158 {
159 return invokeObjcSelf!(void, "layoutManagerDidInvalidateLayout:", NSLayoutManager)(sender);
160 }
161
162 void layoutManager (NSLayoutManager layoutManager, NSTextContainer textContainer, bool layoutFinishedFlag)
163 {
164 return invokeObjcSelf!(void, "layoutManager:didCompleteLayoutForTextContainer:atEnd:", NSLayoutManager, NSTextContainer, bool)(layoutManager, textContainer, layoutFinishedFlag);
165 }
166
167 NSDictionary layoutManager (NSLayoutManager layoutManager, NSDictionary attrs, bool toScreen, NSUInteger charIndex, NSRangePointer effectiveCharRange)
168 {
169 return invokeObjcSelf!(NSDictionary, "layoutManager:shouldUseTemporaryAttributes:forDrawingToScreen:atCharacterIndex:effectiveRange:", NSLayoutManager, NSDictionary, bool, NSUInteger, NSRangePointer)(layoutManager, attrs, toScreen, charIndex, effectiveCharRange);
170 }
171
172 //mixin ObjcBindMethod!(layoutManagerDidInvalidateLayout, "layoutManagerDidInvalidateLayout:");
173 //mixin ObjcBindMethod!(layoutManager, "layoutManager:didCompleteLayoutForTextContainer:atEnd:");
174 //mixin ObjcBindMethod!(layoutManager, "layoutManager:shouldUseTemporaryAttributes:forDrawingToScreen:atCharacterIndex:effectiveRange:");
175
176 `;
177
178 class NSLayoutManager : NSObject, INSCoding, INSGlyphStorage
179 {
180 mixin (ObjcWrap);
181
182 this (NSCoder aDecoder)
183 {
184 super(typeof(this).alloc.initWithCoder(aDecoder).objcObject);
185 }
186
187 void encodeWithCoder (NSCoder aCoder)
188 {
189 return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder);
190 }
191
192 typeof(this) initWithCoder (NSCoder aDecoder)
193 {
194 return invokeObjcSelf!(typeof(this), "initWithCoder:", NSCoder)(aDecoder);
195 }
196
197 typeof(this) copyWithZone (NSZone* zone)
198 {
199 return invokeObjcSelf!(typeof(this), "copyWithZone:", NSZone*)(zone);
200 }
201
202 NSLayoutManager init ()
203 {
204 id result = invokeObjcSelf!(id, "init");
205 return result is this.objcObject ? this : (result !is null ? new NSLayoutManager(result) : null);
206 }
207
208 this ()
209 {
210 super(NSLayoutManager.alloc.init.objcObject);
211 }
212
213 NSTextStorage textStorage ()
214 {
215 return invokeObjcSelf!(NSTextStorage, "textStorage");
216 }
217
218 void setTextStorage (NSTextStorage textStorage)
219 {
220 return invokeObjcSelf!(void, "setTextStorage:", NSTextStorage)(textStorage);
221 }
222
223 NSAttributedString attributedString ()
224 {
225 return invokeObjcSelf!(NSAttributedString, "attributedString");
226 }
227
228 void replaceTextStorage (NSTextStorage newTextStorage)
229 {
230 return invokeObjcSelf!(void, "replaceTextStorage:", NSTextStorage)(newTextStorage);
231 }
232
233 NSGlyphGenerator glyphGenerator ()
234 {
235 return invokeObjcSelf!(NSGlyphGenerator, "glyphGenerator");
236 }
237
238 void setGlyphGenerator (NSGlyphGenerator glyphGenerator)
239 {
240 return invokeObjcSelf!(void, "setGlyphGenerator:", NSGlyphGenerator)(glyphGenerator);
241 }
242
243 NSTypesetter typesetter ()
244 {
245 return invokeObjcSelf!(NSTypesetter, "typesetter");
246 }
247
248 void setTypesetter (NSTypesetter typesetter)
249 {
250 return invokeObjcSelf!(void, "setTypesetter:", NSTypesetter)(typesetter);
251 }
252
253 Object delegate_ ()
254 {
255 return invokeObjcSelf!(Object, "delegate");
256 }
257
258 void setDelegate (Object delegate_)
259 {
260 return invokeObjcSelf!(void, "setDelegate:", Object)(delegate_);
261 }
262
263 NSArray textContainers ()
264 {
265 return invokeObjcSelf!(NSArray, "textContainers");
266 }
267
268 void addTextContainer (NSTextContainer container)
269 {
270 return invokeObjcSelf!(void, "addTextContainer:", NSTextContainer)(container);
271 }
272
273 void insertTextContainer (NSTextContainer container, NSUInteger index)
274 {
275 return invokeObjcSelf!(void, "insertTextContainer:atIndex:", NSTextContainer, NSUInteger)(container, index);
276 }
277
278 void removeTextContainerAtIndex (NSUInteger index)
279 {
280 return invokeObjcSelf!(void, "removeTextContainerAtIndex:", NSUInteger)(index);
281 }
282
283 void textContainerChangedGeometry (NSTextContainer container)
284 {
285 return invokeObjcSelf!(void, "textContainerChangedGeometry:", NSTextContainer)(container);
286 }
287
288 void textContainerChangedTextView (NSTextContainer container)
289 {
290 return invokeObjcSelf!(void, "textContainerChangedTextView:", NSTextContainer)(container);
291 }
292
293 void setBackgroundLayoutEnabled (bool flag)
294 {
295 return invokeObjcSelf!(void, "setBackgroundLayoutEnabled:", bool)(flag);
296 }
297
298 bool backgroundLayoutEnabled ()
299 {
300 return invokeObjcSelf!(bool, "backgroundLayoutEnabled");
301 }
302
303 void setUsesScreenFonts (bool flag)
304 {
305 return invokeObjcSelf!(void, "setUsesScreenFonts:", bool)(flag);
306 }
307
308 bool usesScreenFonts ()
309 {
310 return invokeObjcSelf!(bool, "usesScreenFonts");
311 }
312
313 void setShowsInvisibleCharacters (bool flag)
314 {
315 return invokeObjcSelf!(void, "setShowsInvisibleCharacters:", bool)(flag);
316 }
317
318 bool showsInvisibleCharacters ()
319 {
320 return invokeObjcSelf!(bool, "showsInvisibleCharacters");
321 }
322
323 void setShowsControlCharacters (bool flag)
324 {
325 return invokeObjcSelf!(void, "setShowsControlCharacters:", bool)(flag);
326 }
327
328 bool showsControlCharacters ()
329 {
330 return invokeObjcSelf!(bool, "showsControlCharacters");
331 }
332
333 void setHyphenationFactor (float factor)
334 {
335 return invokeObjcSelf!(void, "setHyphenationFactor:", float)(factor);
336 }
337
338 float hyphenationFactor ()
339 {
340 return invokeObjcSelf!(float, "hyphenationFactor");
341 }
342
343 void setDefaultAttachmentScaling (uint scaling)
344 {
345 return invokeObjcSelf!(void, "setDefaultAttachmentScaling:", uint)(scaling);
346 }
347
348 uint defaultAttachmentScaling ()
349 {
350 return invokeObjcSelf!(uint, "defaultAttachmentScaling");
351 }
352
353 void setTypesetterBehavior (int theBehavior)
354 {
355 return invokeObjcSelf!(void, "setTypesetterBehavior:", int)(theBehavior);
356 }
357
358 int typesetterBehavior ()
359 {
360 return invokeObjcSelf!(int, "typesetterBehavior");
361 }
362
363 NSUInteger layoutOptions ()
364 {
365 return invokeObjcSelf!(NSUInteger, "layoutOptions");
366 }
367
368 void setAllowsNonContiguousLayout (bool flag)
369 {
370 return invokeObjcSelf!(void, "setAllowsNonContiguousLayout:", bool)(flag);
371 }
372
373 bool allowsNonContiguousLayout ()
374 {
375 return invokeObjcSelf!(bool, "allowsNonContiguousLayout");
376 }
377
378 bool hasNonContiguousLayout ()
379 {
380 return invokeObjcSelf!(bool, "hasNonContiguousLayout");
381 }
382
383 void invalidateGlyphsForCharacterRange (NSRange charRange, NSInteger delta, NSRangePointer actualCharRange)
384 {
385 return invokeObjcSelf!(void, "invalidateGlyphsForCharacterRange:changeInLength:actualCharacterRange:", NSRange, NSInteger, NSRangePointer)(charRange, delta, actualCharRange);
386 }
387
388 void invalidateLayoutForCharacterRange (NSRange charRange, NSRangePointer actualCharRange)
389 {
390 return invokeObjcSelf!(void, "invalidateLayoutForCharacterRange:actualCharacterRange:", NSRange, NSRangePointer)(charRange, actualCharRange);
391 }
392
393 void invalidateLayoutForCharacterRange (NSRange charRange, bool flag, NSRangePointer actualCharRange)
394 {
395 return invokeObjcSelf!(void, "invalidateLayoutForCharacterRange:isSoft:actualCharacterRange:", NSRange, bool, NSRangePointer)(charRange, flag, actualCharRange);
396 }
397
398 void invalidateDisplayForCharacterRange (NSRange charRange)
399 {
400 return invokeObjcSelf!(void, "invalidateDisplayForCharacterRange:", NSRange)(charRange);
401 }
402
403 void invalidateDisplayForGlyphRange (NSRange glyphRange)
404 {
405 return invokeObjcSelf!(void, "invalidateDisplayForGlyphRange:", NSRange)(glyphRange);
406 }
407
408 void textStorage (NSTextStorage str, NSUInteger editedMask, NSRange newCharRange, NSInteger delta, NSRange invalidatedCharRange)
409 {
410 return invokeObjcSelf!(void, "textStorage:edited:range:changeInLength:invalidatedRange:", NSTextStorage, NSUInteger, NSRange, NSInteger, NSRange)(str, editedMask, newCharRange, delta, invalidatedCharRange);
411 }
412
413 void ensureGlyphsForCharacterRange (NSRange charRange)
414 {
415 return invokeObjcSelf!(void, "ensureGlyphsForCharacterRange:", NSRange)(charRange);
416 }
417
418 void ensureGlyphsForGlyphRange (NSRange glyphRange)
419 {
420 return invokeObjcSelf!(void, "ensureGlyphsForGlyphRange:", NSRange)(glyphRange);
421 }
422
423 void ensureLayoutForCharacterRange (NSRange charRange)
424 {
425 return invokeObjcSelf!(void, "ensureLayoutForCharacterRange:", NSRange)(charRange);
426 }
427
428 void ensureLayoutForGlyphRange (NSRange glyphRange)
429 {
430 return invokeObjcSelf!(void, "ensureLayoutForGlyphRange:", NSRange)(glyphRange);
431 }
432
433 void ensureLayoutForTextContainer (NSTextContainer container)
434 {
435 return invokeObjcSelf!(void, "ensureLayoutForTextContainer:", NSTextContainer)(container);
436 }
437
438 void ensureLayoutForBoundingRect (NSRect bounds, NSTextContainer container)
439 {
440 return invokeObjcSelf!(void, "ensureLayoutForBoundingRect:inTextContainer:", NSRect, NSTextContainer)(bounds, container);
441 }
442
443 void insertGlyphs (NSGlyph* glyphs, NSUInteger length, NSUInteger glyphIndex, NSUInteger charIndex)
444 {
445 return invokeObjcSelf!(void, "insertGlyphs:length:forStartingGlyphAtIndex:characterIndex:", NSGlyph*, NSUInteger, NSUInteger, NSUInteger)(glyphs, length, glyphIndex, charIndex);
446 }
447
448 void insertGlyph (uint glyph, NSUInteger glyphIndex, NSUInteger charIndex)
449 {
450 return invokeObjcSelf!(void, "insertGlyph:atGlyphIndex:characterIndex:", uint, NSUInteger, NSUInteger)(glyph, glyphIndex, charIndex);
451 }
452
453 void replaceGlyphAtIndex (NSUInteger glyphIndex, uint newGlyph)
454 {
455 return invokeObjcSelf!(void, "replaceGlyphAtIndex:withGlyph:", NSUInteger, uint)(glyphIndex, newGlyph);
456 }
457
458 void deleteGlyphsInRange (NSRange glyphRange)
459 {
460 return invokeObjcSelf!(void, "deleteGlyphsInRange:", NSRange)(glyphRange);
461 }
462
463 void setCharacterIndex (NSUInteger charIndex, NSUInteger glyphIndex)
464 {
465 return invokeObjcSelf!(void, "setCharacterIndex:forGlyphAtIndex:", NSUInteger, NSUInteger)(charIndex, glyphIndex);
466 }
467
468 void setIntAttribute (NSInteger attributeTag, NSInteger val, NSUInteger glyphIndex)
469 {
470 return invokeObjcSelf!(void, "setIntAttribute:value:forGlyphAtIndex:", NSInteger, NSInteger, NSUInteger)(attributeTag, val, glyphIndex);
471 }
472
473 void invalidateGlyphsOnLayoutInvalidationForGlyphRange (NSRange glyphRange)
474 {
475 return invokeObjcSelf!(void, "invalidateGlyphsOnLayoutInvalidationForGlyphRange:", NSRange)(glyphRange);
476 }
477
478 NSUInteger numberOfGlyphs ()
479 {
480 return invokeObjcSelf!(NSUInteger, "numberOfGlyphs");
481 }
482
483 uint glyphAtIndex (NSUInteger glyphIndex, bool* isValidIndex)
484 {
485 return invokeObjcSelf!(uint, "glyphAtIndex:isValidIndex:", NSUInteger, bool*)(glyphIndex, isValidIndex);
486 }
487
488 uint glyphAtIndex (NSUInteger glyphIndex)
489 {
490 return invokeObjcSelf!(uint, "glyphAtIndex:", NSUInteger)(glyphIndex);
491 }
492
493 bool isValidGlyphIndex (NSUInteger glyphIndex)
494 {
495 return invokeObjcSelf!(bool, "isValidGlyphIndex:", NSUInteger)(glyphIndex);
496 }
497
498 NSUInteger characterIndexForGlyphAtIndex (NSUInteger glyphIndex)
499 {
500 return invokeObjcSelf!(NSUInteger, "characterIndexForGlyphAtIndex:", NSUInteger)(glyphIndex);
501 }
502
503 NSUInteger glyphIndexForCharacterAtIndex (NSUInteger charIndex)
504 {
505 return invokeObjcSelf!(NSUInteger, "glyphIndexForCharacterAtIndex:", NSUInteger)(charIndex);
506 }
507
508 NSInteger intAttribute (NSInteger attributeTag, NSUInteger glyphIndex)
509 {
510 return invokeObjcSelf!(NSInteger, "intAttribute:forGlyphAtIndex:", NSInteger, NSUInteger)(attributeTag, glyphIndex);
511 }
512
513 NSUInteger getGlyphsInRange (NSRange glyphRange, NSGlyph* glyphBuffer, NSUInteger* charIndexBuffer, NSGlyphInscription* inscribeBuffer, bool* elasticBuffer)
514 {
515 return invokeObjcSelf!(NSUInteger, "getGlyphsInRange:glyphs:characterIndexes:glyphInscriptions:elasticBits:", NSRange, NSGlyph*, NSUInteger*, NSGlyphInscription*, bool*)(glyphRange, glyphBuffer, charIndexBuffer, inscribeBuffer, elasticBuffer);
516 }
517
518 NSUInteger getGlyphsInRange (NSRange glyphRange, NSGlyph* glyphBuffer, NSUInteger* charIndexBuffer, NSGlyphInscription* inscribeBuffer, bool* elasticBuffer, char* bidiLevelBuffer)
519 {
520 return invokeObjcSelf!(NSUInteger, "getGlyphsInRange:glyphs:characterIndexes:glyphInscriptions:elasticBits:bidiLevels:", NSRange, NSGlyph*, NSUInteger*, NSGlyphInscription*, bool*, char*)(glyphRange, glyphBuffer, charIndexBuffer, inscribeBuffer, elasticBuffer, bidiLevelBuffer);
521 }
522
523 NSUInteger getGlyphs (NSGlyph* glyphArray, NSRange glyphRange)
524 {
525 return invokeObjcSelf!(NSUInteger, "getGlyphs:range:", NSGlyph*, NSRange)(glyphArray, glyphRange);
526 }
527
528 void setTextContainer (NSTextContainer container, NSRange glyphRange)
529 {
530 return invokeObjcSelf!(void, "setTextContainer:forGlyphRange:", NSTextContainer, NSRange)(container, glyphRange);
531 }
532
533 void setLineFragmentRect (NSRect fragmentRect, NSRange glyphRange, NSRect usedRect)
534 {
535 return invokeObjcSelf!(void, "setLineFragmentRect:forGlyphRange:usedRect:", NSRect, NSRange, NSRect)(fragmentRect, glyphRange, usedRect);
536 }
537
538 void setExtraLineFragmentRect (NSRect fragmentRect, NSRect usedRect, NSTextContainer container)
539 {
540 return invokeObjcSelf!(void, "setExtraLineFragmentRect:usedRect:textContainer:", NSRect, NSRect, NSTextContainer)(fragmentRect, usedRect, container);
541 }
542
543 void setLocation (NSPoint location, NSRange glyphRange)
544 {
545 return invokeObjcSelf!(void, "setLocation:forStartOfGlyphRange:", NSPoint, NSRange)(location, glyphRange);
546 }
547
548 void setLocations (NSPointArray locations, NSUInteger* glyphIndexes, NSUInteger count, NSRange glyphRange)
549 {
550 return invokeObjcSelf!(void, "setLocations:startingGlyphIndexes:count:forGlyphRange:", NSPointArray, NSUInteger*, NSUInteger, NSRange)(locations, glyphIndexes, count, glyphRange);
551 }
552
553 void setNotShownAttribute (bool flag, NSUInteger glyphIndex)
554 {
555 return invokeObjcSelf!(void, "setNotShownAttribute:forGlyphAtIndex:", bool, NSUInteger)(flag, glyphIndex);
556 }
557
558 void setDrawsOutsideLineFragment (bool flag, NSUInteger glyphIndex)
559 {
560 return invokeObjcSelf!(void, "setDrawsOutsideLineFragment:forGlyphAtIndex:", bool, NSUInteger)(flag, glyphIndex);
561 }
562
563 void setAttachmentSize (NSSize attachmentSize, NSRange glyphRange)
564 {
565 return invokeObjcSelf!(void, "setAttachmentSize:forGlyphRange:", NSSize, NSRange)(attachmentSize, glyphRange);
566 }
567
568 void getFirstUnlaidCharacterIndex (NSUInteger* charIndex, NSUInteger* glyphIndex)
569 {
570 return invokeObjcSelf!(void, "getFirstUnlaidCharacterIndex:glyphIndex:", NSUInteger*, NSUInteger*)(charIndex, glyphIndex);
571 }
572
573 NSUInteger firstUnlaidCharacterIndex ()
574 {
575 return invokeObjcSelf!(NSUInteger, "firstUnlaidCharacterIndex");
576 }
577
578 NSUInteger firstUnlaidGlyphIndex ()
579 {
580 return invokeObjcSelf!(NSUInteger, "firstUnlaidGlyphIndex");
581 }
582
583 NSTextContainer textContainerForGlyphAtIndex (NSUInteger glyphIndex, NSRangePointer effectiveGlyphRange)
584 {
585 return invokeObjcSelf!(NSTextContainer, "textContainerForGlyphAtIndex:effectiveRange:", NSUInteger, NSRangePointer)(glyphIndex, effectiveGlyphRange);
586 }
587
588 NSRect usedRectForTextContainer (NSTextContainer container)
589 {
590 return invokeObjcSelf!(NSRect, "usedRectForTextContainer:", NSTextContainer)(container);
591 }
592
593 NSRect lineFragmentRectForGlyphAtIndex (NSUInteger glyphIndex, NSRangePointer effectiveGlyphRange)
594 {
595 return invokeObjcSelf!(NSRect, "lineFragmentRectForGlyphAtIndex:effectiveRange:", NSUInteger, NSRangePointer)(glyphIndex, effectiveGlyphRange);
596 }
597
598 NSRect lineFragmentUsedRectForGlyphAtIndex (NSUInteger glyphIndex, NSRangePointer effectiveGlyphRange)
599 {
600 return invokeObjcSelf!(NSRect, "lineFragmentUsedRectForGlyphAtIndex:effectiveRange:", NSUInteger, NSRangePointer)(glyphIndex, effectiveGlyphRange);
601 }
602
603 NSRect lineFragmentRectForGlyphAtIndex (NSUInteger glyphIndex, NSRangePointer effectiveGlyphRange, bool flag)
604 {
605 return invokeObjcSelf!(NSRect, "lineFragmentRectForGlyphAtIndex:effectiveRange:withoutAdditionalLayout:", NSUInteger, NSRangePointer, bool)(glyphIndex, effectiveGlyphRange, flag);
606 }
607
608 NSRect lineFragmentUsedRectForGlyphAtIndex (NSUInteger glyphIndex, NSRangePointer effectiveGlyphRange, bool flag)
609 {
610 return invokeObjcSelf!(NSRect, "lineFragmentUsedRectForGlyphAtIndex:effectiveRange:withoutAdditionalLayout:", NSUInteger, NSRangePointer, bool)(glyphIndex, effectiveGlyphRange, flag);
611 }
612
613 NSTextContainer textContainerForGlyphAtIndex (NSUInteger glyphIndex, NSRangePointer effectiveGlyphRange, bool flag)
614 {
615 return invokeObjcSelf!(NSTextContainer, "textContainerForGlyphAtIndex:effectiveRange:withoutAdditionalLayout:", NSUInteger, NSRangePointer, bool)(glyphIndex, effectiveGlyphRange, flag);
616 }
617
618 NSRect extraLineFragmentRect ()
619 {
620 return invokeObjcSelf!(NSRect, "extraLineFragmentRect");
621 }
622
623 NSRect extraLineFragmentUsedRect ()
624 {
625 return invokeObjcSelf!(NSRect, "extraLineFragmentUsedRect");
626 }
627
628 NSTextContainer extraLineFragmentTextContainer ()
629 {
630 return invokeObjcSelf!(NSTextContainer, "extraLineFragmentTextContainer");
631 }
632
633 NSPoint locationForGlyphAtIndex (NSUInteger glyphIndex)
634 {
635 return invokeObjcSelf!(NSPoint, "locationForGlyphAtIndex:", NSUInteger)(glyphIndex);
636 }
637
638 bool notShownAttributeForGlyphAtIndex (NSUInteger glyphIndex)
639 {
640 return invokeObjcSelf!(bool, "notShownAttributeForGlyphAtIndex:", NSUInteger)(glyphIndex);
641 }
642
643 bool drawsOutsideLineFragmentForGlyphAtIndex (NSUInteger glyphIndex)
644 {
645 return invokeObjcSelf!(bool, "drawsOutsideLineFragmentForGlyphAtIndex:", NSUInteger)(glyphIndex);
646 }
647
648 NSSize attachmentSizeForGlyphAtIndex (NSUInteger glyphIndex)
649 {
650 return invokeObjcSelf!(NSSize, "attachmentSizeForGlyphAtIndex:", NSUInteger)(glyphIndex);
651 }
652
653 void setLayoutRect (NSRect rect, NSTextBlock block, NSRange glyphRange)
654 {
655 return invokeObjcSelf!(void, "setLayoutRect:forTextBlock:glyphRange:", NSRect, NSTextBlock, NSRange)(rect, block, glyphRange);
656 }
657
658 void setBoundsRect (NSRect rect, NSTextBlock block, NSRange glyphRange)
659 {
660 return invokeObjcSelf!(void, "setBoundsRect:forTextBlock:glyphRange:", NSRect, NSTextBlock, NSRange)(rect, block, glyphRange);
661 }
662
663 NSRect layoutRectForTextBlock (NSTextBlock block, NSRange glyphRange)
664 {
665 return invokeObjcSelf!(NSRect, "layoutRectForTextBlock:glyphRange:", NSTextBlock, NSRange)(block, glyphRange);
666 }
667
668 NSRect boundsRectForTextBlock (NSTextBlock block, NSRange glyphRange)
669 {
670 return invokeObjcSelf!(NSRect, "boundsRectForTextBlock:glyphRange:", NSTextBlock, NSRange)(block, glyphRange);
671 }
672
673 NSRect layoutRectForTextBlock (NSTextBlock block, NSUInteger glyphIndex, NSRangePointer effectiveGlyphRange)
674 {
675 return invokeObjcSelf!(NSRect, "layoutRectForTextBlock:atIndex:effectiveRange:", NSTextBlock, NSUInteger, NSRangePointer)(block, glyphIndex, effectiveGlyphRange);
676 }
677
678 NSRect boundsRectForTextBlock (NSTextBlock block, NSUInteger glyphIndex, NSRangePointer effectiveGlyphRange)
679 {
680 return invokeObjcSelf!(NSRect, "boundsRectForTextBlock:atIndex:effectiveRange:", NSTextBlock, NSUInteger, NSRangePointer)(block, glyphIndex, effectiveGlyphRange);
681 }
682
683 NSRange glyphRangeForCharacterRange (NSRange charRange, NSRangePointer actualCharRange)
684 {
685 return invokeObjcSelf!(NSRange, "glyphRangeForCharacterRange:actualCharacterRange:", NSRange, NSRangePointer)(charRange, actualCharRange);
686 }
687
688 NSRange characterRangeForGlyphRange (NSRange glyphRange, NSRangePointer actualGlyphRange)
689 {
690 return invokeObjcSelf!(NSRange, "characterRangeForGlyphRange:actualGlyphRange:", NSRange, NSRangePointer)(glyphRange, actualGlyphRange);
691 }
692
693 NSRange glyphRangeForTextContainer (NSTextContainer container)
694 {
695 return invokeObjcSelf!(NSRange, "glyphRangeForTextContainer:", NSTextContainer)(container);
696 }
697
698 NSRange rangeOfNominallySpacedGlyphsContainingIndex (NSUInteger glyphIndex)
699 {
700 return invokeObjcSelf!(NSRange, "rangeOfNominallySpacedGlyphsContainingIndex:", NSUInteger)(glyphIndex);
701 }
702
703 NSRectArray rectArrayForCharacterRange (NSRange charRange, NSRange selCharRange, NSTextContainer container, NSUInteger* rectCount)
704 {
705 return invokeObjcSelf!(NSRectArray, "rectArrayForCharacterRange:withinSelectedCharacterRange:inTextContainer:rectCount:", NSRange, NSRange, NSTextContainer, NSUInteger*)(charRange, selCharRange, container, rectCount);
706 }
707
708 NSRectArray rectArrayForGlyphRange (NSRange glyphRange, NSRange selGlyphRange, NSTextContainer container, NSUInteger* rectCount)
709 {
710 return invokeObjcSelf!(NSRectArray, "rectArrayForGlyphRange:withinSelectedGlyphRange:inTextContainer:rectCount:", NSRange, NSRange, NSTextContainer, NSUInteger*)(glyphRange, selGlyphRange, container, rectCount);
711 }
712
713 NSRect boundingRectForGlyphRange (NSRange glyphRange, NSTextContainer container)
714 {
715 return invokeObjcSelf!(NSRect, "boundingRectForGlyphRange:inTextContainer:", NSRange, NSTextContainer)(glyphRange, container);
716 }
717
718 NSRange glyphRangeForBoundingRect (NSRect bounds, NSTextContainer container)
719 {
720 return invokeObjcSelf!(NSRange, "glyphRangeForBoundingRect:inTextContainer:", NSRect, NSTextContainer)(bounds, container);
721 }
722
723 NSRange glyphRangeForBoundingRectWithoutAdditionalLayout (NSRect bounds, NSTextContainer container)
724 {
725 return invokeObjcSelf!(NSRange, "glyphRangeForBoundingRectWithoutAdditionalLayout:inTextContainer:", NSRect, NSTextContainer)(bounds, container);
726 }
727
728 NSUInteger glyphIndexForPoint (NSPoint point, NSTextContainer container, CGFloat* partialFraction)
729 {
730 return invokeObjcSelf!(NSUInteger, "glyphIndexForPoint:inTextContainer:fractionOfDistanceThroughGlyph:", NSPoint, NSTextContainer, CGFloat*)(point, container, partialFraction);
731 }
732
733 NSUInteger glyphIndexForPoint (NSPoint point, NSTextContainer container)
734 {
735 return invokeObjcSelf!(NSUInteger, "glyphIndexForPoint:inTextContainer:", NSPoint, NSTextContainer)(point, container);
736 }
737
738 CGFloat fractionOfDistanceThroughGlyphForPoint (NSPoint point, NSTextContainer container)
739 {
740 return invokeObjcSelf!(CGFloat, "fractionOfDistanceThroughGlyphForPoint:inTextContainer:", NSPoint, NSTextContainer)(point, container);
741 }
742
743 NSUInteger getLineFragmentInsertionPointsForCharacterAtIndex (NSUInteger charIndex, bool aFlag, bool dFlag, CGFloat* positions, NSUInteger* charIndexes)
744 {
745 return invokeObjcSelf!(NSUInteger, "getLineFragmentInsertionPointsForCharacterAtIndex:alternatePositions:inDisplayOrder:positions:characterIndexes:", NSUInteger, bool, bool, CGFloat*, NSUInteger*)(charIndex, aFlag, dFlag, positions, charIndexes);
746 }
747
748 NSDictionary temporaryAttributesAtCharacterIndex (NSUInteger charIndex, NSRangePointer effectiveCharRange)
749 {
750 return invokeObjcSelf!(NSDictionary, "temporaryAttributesAtCharacterIndex:effectiveRange:", NSUInteger, NSRangePointer)(charIndex, effectiveCharRange);
751 }
752
753 void setTemporaryAttributes (NSDictionary attrs, NSRange charRange)
754 {
755 return invokeObjcSelf!(void, "setTemporaryAttributes:forCharacterRange:", NSDictionary, NSRange)(attrs, charRange);
756 }
757
758 void addTemporaryAttributes (NSDictionary attrs, NSRange charRange)
759 {
760 return invokeObjcSelf!(void, "addTemporaryAttributes:forCharacterRange:", NSDictionary, NSRange)(attrs, charRange);
761 }
762
763 void removeTemporaryAttribute (NSString attrName, NSRange charRange)
764 {
765 return invokeObjcSelf!(void, "removeTemporaryAttribute:forCharacterRange:", NSString, NSRange)(attrName, charRange);
766 }
767
768 Object temporaryAttribute (NSString attrName, NSUInteger location, NSRangePointer range)
769 {
770 return invokeObjcSelf!(Object, "temporaryAttribute:atCharacterIndex:effectiveRange:", NSString, NSUInteger, NSRangePointer)(attrName, location, range);
771 }
772
773 Object temporaryAttribute (NSString attrName, NSUInteger location, NSRangePointer range, NSRange rangeLimit)
774 {
775 return invokeObjcSelf!(Object, "temporaryAttribute:atCharacterIndex:longestEffectiveRange:inRange:", NSString, NSUInteger, NSRangePointer, NSRange)(attrName, location, range, rangeLimit);
776 }
777
778 NSDictionary temporaryAttributesAtCharacterIndex (NSUInteger location, NSRangePointer range, NSRange rangeLimit)
779 {
780 return invokeObjcSelf!(NSDictionary, "temporaryAttributesAtCharacterIndex:longestEffectiveRange:inRange:", NSUInteger, NSRangePointer, NSRange)(location, range, rangeLimit);
781 }
782
783 void addTemporaryAttribute (NSString attrName, Object value, NSRange charRange)
784 {
785 return invokeObjcSelf!(void, "addTemporaryAttribute:value:forCharacterRange:", NSString, Object, NSRange)(attrName, value, charRange);
786 }
787
788 NSFont substituteFontForFont (NSFont originalFont)
789 {
790 return invokeObjcSelf!(NSFont, "substituteFontForFont:", NSFont)(originalFont);
791 }
792
793 CGFloat defaultLineHeightForFont (NSFont theFont)
794 {
795 return invokeObjcSelf!(CGFloat, "defaultLineHeightForFont:", NSFont)(theFont);
796 }
797
798 CGFloat defaultBaselineOffsetForFont (NSFont theFont)
799 {
800 return invokeObjcSelf!(CGFloat, "defaultBaselineOffsetForFont:", NSFont)(theFont);
801 }
802
803 bool usesFontLeading ()
804 {
805 return invokeObjcSelf!(bool, "usesFontLeading");
806 }
807
808 void setUsesFontLeading (bool flag)
809 {
810 return invokeObjcSelf!(void, "setUsesFontLeading:", bool)(flag);
811 }
812
813 void insertGlyphs (NSGlyph* glyphs, NSUInteger length, NSUInteger glyphIndex, NSUInteger charIndex)
814 {
815 return invokeObjcSelf!(void, "insertGlyphs:length:forStartingGlyphAtIndex:characterIndex:", NSGlyph*, NSUInteger, NSUInteger, NSUInteger)(glyphs, length, glyphIndex, charIndex);
816 }
817
818 void setIntAttribute (NSInteger attributeTag, NSInteger val, NSUInteger glyphIndex)
819 {
820 return invokeObjcSelf!(void, "setIntAttribute:value:forGlyphAtIndex:", NSInteger, NSInteger, NSUInteger)(attributeTag, val, glyphIndex);
821 }
822
823 // NSTextViewSupport
824 NSArray rulerMarkersForTextView (NSTextView view, NSParagraphStyle style, NSRulerView ruler)
825 {
826 return invokeObjcSelf!(NSArray, "rulerMarkersForTextView:paragraphStyle:ruler:", NSTextView, NSParagraphStyle, NSRulerView)(view, style, ruler);
827 }
828
829 NSView rulerAccessoryViewForTextView (NSTextView view, NSParagraphStyle style, NSRulerView ruler, bool isEnabled)
830 {
831 return invokeObjcSelf!(NSView, "rulerAccessoryViewForTextView:paragraphStyle:ruler:enabled:", NSTextView, NSParagraphStyle, NSRulerView, bool)(view, style, ruler, isEnabled);
832 }
833
834 bool layoutManagerOwnsFirstResponderInWindow (NSWindow window)
835 {
836 return invokeObjcSelf!(bool, "layoutManagerOwnsFirstResponderInWindow:", NSWindow)(window);
837 }
838
839 NSTextView firstTextView ()
840 {
841 return invokeObjcSelf!(NSTextView, "firstTextView");
842 }
843
844 NSTextView textViewForBeginningOfSelection ()
845 {
846 return invokeObjcSelf!(NSTextView, "textViewForBeginningOfSelection");
847 }
848
849 void drawBackgroundForGlyphRange (NSRange glyphsToShow, NSPoint origin)
850 {
851 return invokeObjcSelf!(void, "drawBackgroundForGlyphRange:atPoint:", NSRange, NSPoint)(glyphsToShow, origin);
852 }
853
854 void drawGlyphsForGlyphRange (NSRange glyphsToShow, NSPoint origin)
855 {
856 return invokeObjcSelf!(void, "drawGlyphsForGlyphRange:atPoint:", NSRange, NSPoint)(glyphsToShow, origin);
857 }
858
859 void showPackedGlyphs (char* glyphs, NSUInteger glyphLen, NSRange glyphRange, NSPoint point, NSFont font, NSColor color, NSSize printingAdjustment)
860 {
861 return invokeObjcSelf!(void, "showPackedGlyphs:length:glyphRange:atPoint:font:color:printingAdjustment:", char*, NSUInteger, NSRange, NSPoint, NSFont, NSColor, NSSize)(glyphs, glyphLen, glyphRange, point, font, color, printingAdjustment);
862 }
863
864 void showAttachmentCell (NSCell cell, NSRect rect, NSUInteger attachmentIndex)
865 {
866 return invokeObjcSelf!(void, "showAttachmentCell:inRect:characterIndex:", NSCell, NSRect, NSUInteger)(cell, rect, attachmentIndex);
867 }
868
869 void drawUnderlineForGlyphRange (NSRange glyphRange, NSInteger underlineVal, CGFloat baselineOffset, NSRect lineRect, NSRange lineGlyphRange, NSPoint containerOrigin)
870 {
871 return invokeObjcSelf!(void, "drawUnderlineForGlyphRange:underlineType:baselineOffset:lineFragmentRect:lineFragmentGlyphRange:containerOrigin:", NSRange, NSInteger, CGFloat, NSRect, NSRange, NSPoint)(glyphRange, underlineVal, baselineOffset, lineRect, lineGlyphRange, containerOrigin);
872 }
873
874 void underlineGlyphRange (NSRange glyphRange, NSInteger underlineVal, NSRect lineRect, NSRange lineGlyphRange, NSPoint containerOrigin)
875 {
876 return invokeObjcSelf!(void, "underlineGlyphRange:underlineType:lineFragmentRect:lineFragmentGlyphRange:containerOrigin:", NSRange, NSInteger, NSRect, NSRange, NSPoint)(glyphRange, underlineVal, lineRect, lineGlyphRange, containerOrigin);
877 }
878
879 void drawStrikethroughForGlyphRange (NSRange glyphRange, NSInteger strikethroughVal, CGFloat baselineOffset, NSRect lineRect, NSRange lineGlyphRange, NSPoint containerOrigin)
880 {
881 return invokeObjcSelf!(void, "drawStrikethroughForGlyphRange:strikethroughType:baselineOffset:lineFragmentRect:lineFragmentGlyphRange:containerOrigin:", NSRange, NSInteger, CGFloat, NSRect, NSRange, NSPoint)(glyphRange, strikethroughVal, baselineOffset, lineRect, lineGlyphRange, containerOrigin);
882 }
883
884 void strikethroughGlyphRange (NSRange glyphRange, NSInteger strikethroughVal, NSRect lineRect, NSRange lineGlyphRange, NSPoint containerOrigin)
885 {
886 return invokeObjcSelf!(void, "strikethroughGlyphRange:strikethroughType:lineFragmentRect:lineFragmentGlyphRange:containerOrigin:", NSRange, NSInteger, NSRect, NSRange, NSPoint)(glyphRange, strikethroughVal, lineRect, lineGlyphRange, containerOrigin);
887 }
888 }