Mercurial > projects > dwt-mac
diff dwt/internal/cocoa/NSLayoutManager.d @ 45:d8635bb48c7c
Merge with SWT 3.5
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Mon, 01 Dec 2008 17:07:00 +0100 |
parents | f565d3a95c0a |
children | 62202ce0039f |
line wrap: on
line diff
--- a/dwt/internal/cocoa/NSLayoutManager.d Tue Oct 21 15:20:04 2008 +0200 +++ b/dwt/internal/cocoa/NSLayoutManager.d Mon Dec 01 17:07:00 2008 +0100 @@ -1,864 +1,134 @@ /******************************************************************************* - * Copyright (c) 2007 IBM Corporation and others. + * Copyright (c) 2000, 2008 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * IBM Corporation - initial API and implementation + * IBM Corporation - initial API and implementation * * Port to the D programming language: - * Jacob Carlborg <jacob.carlborg@gmail.com> + * Jacob Carlborg <doob@me.com> *******************************************************************************/ module dwt.internal.cocoa.NSLayoutManager; -import dwt.internal.cocoa.CGFloat; -import dwt.internal.cocoa.id; -import dwt.internal.cocoa.NSArray; -import dwt.internal.cocoa.NSAttributedString; -import dwt.internal.cocoa.NSCell; -import dwt.internal.cocoa.NSColor; -import dwt.internal.cocoa.NSDictionary; +import dwt.dwthelper.utils; +import dwt.internal.c.Carbon; +import cocoa = dwt.internal.cocoa.id; import dwt.internal.cocoa.NSFont; -import dwt.internal.cocoa.NSGlyphGenerator; -import dwt.internal.cocoa.NSImageCell : NSImageScaling; -import dwt.internal.cocoa.NSInteger; import dwt.internal.cocoa.NSObject; -import dwt.internal.cocoa.NSParagraphStyle; import dwt.internal.cocoa.NSPoint; import dwt.internal.cocoa.NSRange; import dwt.internal.cocoa.NSRect; -import dwt.internal.cocoa.NSRulerView; -import dwt.internal.cocoa.NSSize; import dwt.internal.cocoa.NSString; -import dwt.internal.cocoa.NSTextBlock; import dwt.internal.cocoa.NSTextContainer; -import dwt.internal.cocoa.NSTextStorage; -import dwt.internal.cocoa.NSTextView; import dwt.internal.cocoa.NSTypesetter; -import dwt.internal.cocoa.NSView; -import dwt.internal.cocoa.NSWindow; import dwt.internal.cocoa.OS; +import dwt.internal.objc.cocoa.Cocoa; import objc = dwt.internal.objc.runtime; +public class NSLayoutManager : NSObject { +public this() { + super(); +} + +public this(objc.id id) { + super(id); +} -enum NSGlyphInscription : NSUInteger -{ - NSGlyphInscribeBase = 0, - NSGlyphInscribeBelow = 1, - NSGlyphInscribeAbove = 2, - NSGlyphInscribeOverstrike = 3, - NSGlyphInscribeOverBelow = 4 +public this(cocoa.id id) { + super(id); +} + +public void addTemporaryAttribute(NSString attrName, cocoa.id value, NSRange charRange) { + OS.objc_msgSend(this.id, OS.sel_addTemporaryAttribute_value_forCharacterRange_, attrName !is null ? attrName.id : null, value !is null ? value.id : null, charRange); +} + +public void addTextContainer(NSTextContainer container) { + OS.objc_msgSend(this.id, OS.sel_addTextContainer_, container !is null ? container.id : null); } -alias NSGlyphInscription.NSGlyphInscribeBase NSGlyphInscribeBase; -alias NSGlyphInscription.NSGlyphInscribeBelow NSGlyphInscribeBelow; -alias NSGlyphInscription.NSGlyphInscribeAbove NSGlyphInscribeAbove; -alias NSGlyphInscription.NSGlyphInscribeOverstrike NSGlyphInscribeOverstrike; -alias NSGlyphInscription.NSGlyphInscribeOverBelow NSGlyphInscribeOverBelow; +public NSRect boundingRectForGlyphRange(NSRange glyphRange, NSTextContainer container) { + NSRect result = NSRect(); + OS.objc_msgSend_stret(result, this.id, OS.sel_boundingRectForGlyphRange_inTextContainer_, glyphRange, container !is null ? container.id : null); + return result; +} - +public NSUInteger characterIndexForGlyphAtIndex(NSUInteger glyphIndex) { + return cast(NSUInteger) OS.objc_msgSend(this.id, OS.sel_characterIndexForGlyphAtIndex_, glyphIndex); +} -enum NSTypesetterBehavior : NSInteger -{ - NSTypesetterLatestBehavior = -1, - NSTypesetterOriginalBehavior = 0, - NSTypesetterBehavior_10_2_WithCompatibility = 1, - NSTypesetterBehavior_10_2 = 2, - NSTypesetterBehavior_10_3 = 3, - NSTypesetterBehavior_10_4 = 4 +public CGFloat defaultLineHeightForFont(NSFont theFont) { + return cast(CGFloat) OS.objc_msgSend_fpret(this.id, OS.sel_defaultLineHeightForFont_, theFont !is null ? theFont.id : null); +} + +public void drawBackgroundForGlyphRange(NSRange glyphsToShow, NSPoint origin) { + OS.objc_msgSend(this.id, OS.sel_drawBackgroundForGlyphRange_atPoint_, glyphsToShow, origin); +} + +public void drawGlyphsForGlyphRange(NSRange glyphsToShow, NSPoint origin) { + OS.objc_msgSend(this.id, OS.sel_drawGlyphsForGlyphRange_atPoint_, glyphsToShow, origin); +} + +public NSUInteger getGlyphs(NSGlyph* glyphArray, NSRange glyphRange) { + return OS.objc_msgSend(this.id, OS.sel_getGlyphs_range_, glyphArray, glyphRange); } -alias NSTypesetterBehavior.NSTypesetterLatestBehavior NSTypesetterLatestBehavior; -alias NSTypesetterBehavior.NSTypesetterOriginalBehavior NSTypesetterOriginalBehavior; -alias NSTypesetterBehavior.NSTypesetterBehavior_10_2_WithCompatibility NSTypesetterBehavior_10_2_WithCompatibility; -alias NSTypesetterBehavior.NSTypesetterBehavior_10_2 NSTypesetterBehavior_10_2; -alias NSTypesetterBehavior.NSTypesetterBehavior_10_3 NSTypesetterBehavior_10_3; -alias NSTypesetterBehavior.NSTypesetterBehavior_10_4 NSTypesetterBehavior_10_4; - - - -public class NSLayoutManager : NSObject -{ - - public this () - { - super(); - } - - public this (objc.id id) - { - super(id); - } - - public void addTemporaryAttribute (NSString attrName, id value, NSRange charRange) - { - OS.objc_msgSend(this.id_, OS.sel_addTemporaryAttribute_1value_1forCharacterRange_1, attrName !is null ? attrName.id_ : null, - value !is null ? value.id_ : null, charRange); - } - - public void addTemporaryAttributes (NSDictionary attrs, NSRange charRange) - { - OS.objc_msgSend(this.id_, OS.sel_addTemporaryAttributes_1forCharacterRange_1, attrs !is null ? attrs.id_ : null, charRange); - } - - public void addTextContainer (NSTextContainer container) - { - OS.objc_msgSend(this.id_, OS.sel_addTextContainer_1, container !is null ? container.id_ : null); - } - - public bool allowsNonContiguousLayout () - { - return OS.objc_msgSend(this.id_, OS.sel_allowsNonContiguousLayout) !is null; - } - - public NSSize attachmentSizeForGlyphAtIndex (NSUInteger glyphIndex) - { - NSSize result; - OS.objc_msgSend_stret(&result, this.id_, OS.sel_attachmentSizeForGlyphAtIndex_1, glyphIndex); - return result; - } - - public NSAttributedString attributedString () - { - objc.id result = OS.objc_msgSend(this.id_, OS.sel_attributedString); - return result !is null ? new NSAttributedString(result) : null; - } - - public bool backgroundLayoutEnabled () - { - return OS.objc_msgSend(this.id_, OS.sel_backgroundLayoutEnabled) !is null; - } - - public NSRect boundingRectForGlyphRange (NSRange glyphRange, NSTextContainer container) - { - NSRect result; - OS.objc_msgSend_stret(&result, this.id_, OS.sel_boundingRectForGlyphRange_1inTextContainer_1, glyphRange, - container !is null ? container.id_ : null); - return result; - } - - public NSRect boundsRectForTextBlock_atIndex_effectiveRange_ (NSTextBlock block, NSUInteger glyphIndex, NSRangePointer effectiveGlyphRange) - { - NSRect result; - OS.objc_msgSend_stret(&result, this.id_, OS.sel_boundsRectForTextBlock_1atIndex_1effectiveRange_1, block !is null ? block.id_ : null, - glyphIndex, effectiveGlyphRange); - return result; - } - - public NSRect boundsRectForTextBlock_glyphRange_ (NSTextBlock block, NSRange glyphRange) - { - NSRect result; - OS.objc_msgSend_stret(&result, this.id_, OS.sel_boundsRectForTextBlock_1glyphRange_1, block !is null ? block.id_ : null, glyphRange); - return result; - } - - public NSUInteger characterIndexForGlyphAtIndex (NSUInteger glyphIndex) - { - return cast(NSUInteger) OS.objc_msgSend(this.id_, OS.sel_characterIndexForGlyphAtIndex_1, glyphIndex); - } - - public NSRange characterRangeForGlyphRange (NSRange glyphRange, NSRangePointer actualGlyphRange) - { - NSRange result; - OS.objc_msgSend_stret(&result, this.id_, OS.sel_characterRangeForGlyphRange_1actualGlyphRange_1, glyphRange, actualGlyphRange); - return result; - } +public NSUInteger glyphIndexForCharacterAtIndex(NSUInteger charIndex) { + return cast(NSUInteger) OS.objc_msgSend(this.id, OS.sel_glyphIndexForCharacterAtIndex_, charIndex); +} - public NSImageScaling defaultAttachmentScaling () - { - return cast(NSImageScaling) OS.objc_msgSend(this.id_, OS.sel_defaultAttachmentScaling); - } - - public CGFloat defaultBaselineOffsetForFont (NSFont theFont) - { - return cast(CGFloat) OS.objc_msgSend_fpret(this.id_, OS.sel_defaultBaselineOffsetForFont_1, theFont !is null ? theFont.id_ : null); - } - - public CGFloat defaultLineHeightForFont (NSFont theFont) - { - return cast(CGFloat) OS.objc_msgSend_fpret(this.id_, OS.sel_defaultLineHeightForFont_1, theFont !is null ? theFont.id_ : null); - } - - public id delegatee () - { - objc.id result = OS.objc_msgSend(this.id_, OS.sel_delegate); - return result !is null ? new id(result) : null; - } - - public void deleteGlyphsInRange (NSRange glyphRange) - { - OS.objc_msgSend(this.id_, OS.sel_deleteGlyphsInRange_1, glyphRange); - } - - public void drawBackgroundForGlyphRange (NSRange glyphsToShow, NSPoint origin) - { - OS.objc_msgSend(this.id_, OS.sel_drawBackgroundForGlyphRange_1atPoint_1, glyphsToShow, origin); - } - - public void drawGlyphsForGlyphRange (NSRange glyphsToShow, NSPoint origin) - { - OS.objc_msgSend(this.id_, OS.sel_drawGlyphsForGlyphRange_1atPoint_1, glyphsToShow, origin); - } - - public void drawStrikethroughForGlyphRange (NSRange glyphRange, NSInteger strikethroughVal, CGFloat baselineOffset, NSRect lineRect, - NSRange lineGlyphRange, NSPoint containerOrigin) - { - OS.objc_msgSend( - this.id_, - OS.sel_drawStrikethroughForGlyphRange_1strikethroughType_1baselineOffset_1lineFragmentRect_1lineFragmentGlyphRange_1containerOrigin_1, - glyphRange, strikethroughVal, baselineOffset, lineRect, lineGlyphRange, containerOrigin); - } - - public void drawUnderlineForGlyphRange (NSRange glyphRange, NSInteger underlineVal, CGFloat baselineOffset, NSRect lineRect, - NSRange lineGlyphRange, NSPoint containerOrigin) - { - OS.objc_msgSend(this.id_, - OS.sel_drawUnderlineForGlyphRange_1underlineType_1baselineOffset_1lineFragmentRect_1lineFragmentGlyphRange_1containerOrigin_1, - glyphRange, underlineVal, baselineOffset, lineRect, lineGlyphRange, containerOrigin); - } - - public bool drawsOutsideLineFragmentForGlyphAtIndex (NSUInteger glyphIndex) - { - return OS.objc_msgSend(this.id_, OS.sel_drawsOutsideLineFragmentForGlyphAtIndex_1, glyphIndex) !is null; - } - - public void ensureGlyphsForCharacterRange (NSRange charRange) - { - OS.objc_msgSend(this.id_, OS.sel_ensureGlyphsForCharacterRange_1, charRange); - } - - public void ensureGlyphsForGlyphRange (NSRange glyphRange) - { - OS.objc_msgSend(this.id_, OS.sel_ensureGlyphsForGlyphRange_1, glyphRange); - } - - public void ensureLayoutForBoundingRect (NSRect bounds, NSTextContainer container) - { - OS.objc_msgSend(this.id_, OS.sel_ensureLayoutForBoundingRect_1inTextContainer_1, bounds, container !is null ? container.id_ : null); - } - - public void ensureLayoutForCharacterRange (NSRange charRange) - { - OS.objc_msgSend(this.id_, OS.sel_ensureLayoutForCharacterRange_1, charRange); - } - - public void ensureLayoutForGlyphRange (NSRange glyphRange) - { - OS.objc_msgSend(this.id_, OS.sel_ensureLayoutForGlyphRange_1, glyphRange); - } - - public void ensureLayoutForTextContainer (NSTextContainer container) - { - OS.objc_msgSend(this.id_, OS.sel_ensureLayoutForTextContainer_1, container !is null ? container.id_ : null); - } - - public NSRect extraLineFragmentRect () - { - NSRect result; - OS.objc_msgSend_stret(&result, this.id_, OS.sel_extraLineFragmentRect); - return result; - } - - public NSTextContainer extraLineFragmentTextContainer () - { - objc.id result = OS.objc_msgSend(this.id_, OS.sel_extraLineFragmentTextContainer); - return result !is null ? new NSTextContainer(result) : null; - } +public NSUInteger glyphIndexForPoint(NSPoint point, NSTextContainer container, CGFloat* partialFraction) { + return OS.objc_msgSend(this.id, OS.sel_glyphIndexForPoint_inTextContainer_fractionOfDistanceThroughGlyph_, point, container !is null ? container.id : null, partialFraction); +} - public NSRect extraLineFragmentUsedRect () - { - NSRect result; - OS.objc_msgSend_stret(&result, this.id_, OS.sel_extraLineFragmentUsedRect); - return result; - } - - public NSTextView firstTextView () - { - objc.id result = OS.objc_msgSend(this.id_, OS.sel_firstTextView); - return result !is null ? new NSTextView(result) : null; - } - - public NSUInteger firstUnlaidCharacterIndex () - { - return cast(NSUInteger) OS.objc_msgSend(this.id_, OS.sel_firstUnlaidCharacterIndex); - } - - public NSUInteger firstUnlaidGlyphIndex () - { - return cast(NSUInteger) OS.objc_msgSend(this.id_, OS.sel_firstUnlaidGlyphIndex); - } - - public CGFloat fractionOfDistanceThroughGlyphForPoint (NSPoint point, NSTextContainer container) - { - return cast(CGFloat) OS.objc_msgSend_fpret(this.id_, OS.sel_fractionOfDistanceThroughGlyphForPoint_1inTextContainer_1, point, - container !is null ? container.id_ : null); - } - - public void getFirstUnlaidCharacterIndex (NSUInteger* charIndex, NSUInteger* glyphIndex) - { - OS.objc_msgSend(this.id_, OS.sel_getFirstUnlaidCharacterIndex_1glyphIndex_1, charIndex, glyphIndex); - } - - public NSUInteger getGlyphs (NSGlyph* glyphArray, NSRange glyphRange) - { - return cast(NSUInteger) OS.objc_msgSend(this.id_, OS.sel_getGlyphs_1range_1, glyphArray, glyphRange); - } - - public NSUInteger getGlyphsInRange_glyphs_characterIndexes_glyphInscriptions_elasticBits_ (NSRange glyphRange, NSGlyph* glyphBuffer, - NSUInteger* charIndexBuffer, NSGlyphInscription* inscribeBuffer, bool* elasticBuffer) - { - return cast(NSUInteger) OS.objc_msgSend(this.id_, OS.sel_getGlyphsInRange_1glyphs_1characterIndexes_1glyphInscriptions_1elasticBits_1, glyphRange, glyphBuffer, - charIndexBuffer, inscribeBuffer, elasticBuffer); - } - - public NSUInteger getGlyphsInRange_glyphs_characterIndexes_glyphInscriptions_elasticBits_bidiLevels_ (NSRange glyphRange, NSGlyph* glyphBuffer, - NSUInteger* charIndexBuffer, NSGlyphInscription* inscribeBuffer, bool* elasticBuffer, ubyte* bidiLevelBuffer) - { - return cast(NSUInteger) OS.objc_msgSend(this.id_, OS.sel_getGlyphsInRange_1glyphs_1characterIndexes_1glyphInscriptions_1elasticBits_1bidiLevels_1, glyphRange, - glyphBuffer, charIndexBuffer, inscribeBuffer, elasticBuffer, bidiLevelBuffer); - } - - public NSUInteger getLineFragmentInsertionPointsForCharacterAtIndex (NSUInteger charIndex, bool aFlag, bool dFlag, CGFloat* positions, - NSUInteger* charIndexes) - { - return cast(NSUInteger) OS.objc_msgSend(this.id_, - OS.sel_getLineFragmentInsertionPointsForCharacterAtIndex_1alternatePositions_1inDisplayOrder_1positions_1characterIndexes_1, - charIndex, aFlag, dFlag, positions, charIndexes); - } - - public NSGlyph glyphAtIndex_ (NSUInteger glyphIndex) - { - return cast(NSGlyph) OS.objc_msgSend(this.id_, OS.sel_glyphAtIndex_1, glyphIndex); - } - - public NSGlyph glyphAtIndex_isValidIndex_ (NSUInteger glyphIndex, bool* isValidIndex) - { - return cast(NSGlyph) OS.objc_msgSend(this.id_, OS.sel_glyphAtIndex_1isValidIndex_1, glyphIndex, isValidIndex); - } - - public NSGlyphGenerator glyphGenerator () - { - objc.id result = OS.objc_msgSend(this.id_, OS.sel_glyphGenerator); - return result !is null ? new NSGlyphGenerator(result) : null; - } - - public NSUInteger glyphIndexForCharacterAtIndex (NSUInteger charIndex) - { - return cast(NSUInteger) OS.objc_msgSend(this.id_, OS.sel_glyphIndexForCharacterAtIndex_1, charIndex); - } - - public NSUInteger glyphIndexForPoint_inTextContainer_ (NSPoint point, NSTextContainer container) - { - return cast(NSUInteger) OS.objc_msgSend(this.id_, OS.sel_glyphIndexForPoint_1inTextContainer_1, point, container !is null ? container.id_ : null); - } - - public NSUInteger glyphIndexForPoint_inTextContainer_fractionOfDistanceThroughGlyph_ (NSPoint point, NSTextContainer container, - CGFloat* partialFraction) - { - return cast(NSUInteger) OS.objc_msgSend(this.id_, OS.sel_glyphIndexForPoint_1inTextContainer_1fractionOfDistanceThroughGlyph_1, point, - container !is null ? container.id_ : null, partialFraction); - } +public NSRange glyphRangeForTextContainer(NSTextContainer container) { + NSRange result = NSRange(); + OS.objc_msgSend_stret(result, this.id, OS.sel_glyphRangeForTextContainer_, container !is null ? container.id : null); + return result; +} - public NSRange glyphRangeForBoundingRect (NSRect bounds, NSTextContainer container) - { - NSRange result; - OS.objc_msgSend_stret(&result, this.id_, OS.sel_glyphRangeForBoundingRect_1inTextContainer_1, bounds, container !is null ? container.id_ : null); - return result; - } - - public NSRange glyphRangeForBoundingRectWithoutAdditionalLayout (NSRect bounds, NSTextContainer container) - { - NSRange result; - OS.objc_msgSend_stret(&result, this.id_, OS.sel_glyphRangeForBoundingRectWithoutAdditionalLayout_1inTextContainer_1, bounds, - container !is null ? container.id_ : null); - return result; - } - - public NSRange glyphRangeForCharacterRange (NSRange charRange, NSRangePointer actualCharRange) - { - NSRange result; - OS.objc_msgSend_struct(&result, this.id_, OS.sel_glyphRangeForCharacterRange_1actualCharacterRange_1, &charRange, actualCharRange); - return result; - } - - public NSRange glyphRangeForTextContainer (NSTextContainer container) - { - NSRange result; - OS.objc_msgSend_struct(&result, this.id_, OS.sel_glyphRangeForTextContainer_1, container !is null ? container.id_ : null); - return result; - } - - public bool hasNonContiguousLayout () - { - return OS.objc_msgSend(this.id_, OS.sel_hasNonContiguousLayout) !is null; - } - - public float hyphenationFactor () - { - return cast(float) OS.objc_msgSend_fpret(this.id_, OS.sel_hyphenationFactor); - } - - public void insertGlyph (NSGlyph glyph, NSUInteger glyphIndex, NSUInteger charIndex) - { - OS.objc_msgSend(this.id_, OS.sel_insertGlyph_1atGlyphIndex_1characterIndex_1, glyph, glyphIndex, charIndex); - } - - public void insertGlyphs (/*const*/NSGlyph* glyphs, NSUInteger length, NSUInteger glyphIndex, NSUInteger charIndex) - { - OS.objc_msgSend(this.id_, OS.sel_insertGlyphs_1length_1forStartingGlyphAtIndex_1characterIndex_1, glyphs, length, glyphIndex, charIndex); - } +public NSRect lineFragmentUsedRectForGlyphAtIndex(NSUInteger glyphIndex, NSRangePointer effectiveGlyphRange) { + NSRect result = NSRect(); + OS.objc_msgSend_stret(result, this.id, OS.sel_lineFragmentUsedRectForGlyphAtIndex_effectiveRange_, glyphIndex, effectiveGlyphRange); + return result; +} - public void insertTextContainer (NSTextContainer container, NSUInteger index) - { - OS.objc_msgSend(this.id_, OS.sel_insertTextContainer_1atIndex_1, container !is null ? container.id_ : null, index); - } - - public NSInteger intAttribute (NSInteger attributeTag, NSUInteger glyphIndex) - { - return cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_intAttribute_1forGlyphAtIndex_1, attributeTag, glyphIndex); - } - - public void invalidateDisplayForCharacterRange (NSRange charRange) - { - OS.objc_msgSend(this.id_, OS.sel_invalidateDisplayForCharacterRange_1, charRange); - } - - public void invalidateDisplayForGlyphRange (NSRange glyphRange) - { - OS.objc_msgSend(this.id_, OS.sel_invalidateDisplayForGlyphRange_1, glyphRange); - } - - public void invalidateGlyphsForCharacterRange (NSRange charRange, NSInteger delta, NSRangePointer actualCharRange) - { - OS.objc_msgSend(this.id_, OS.sel_invalidateGlyphsForCharacterRange_1changeInLength_1actualCharacterRange_1, charRange, delta, actualCharRange); - } - - public void invalidateGlyphsOnLayoutInvalidationForGlyphRange (NSRange glyphRange) - { - OS.objc_msgSend(this.id_, OS.sel_invalidateGlyphsOnLayoutInvalidationForGlyphRange_1, glyphRange); - } - - public void invalidateLayoutForCharacterRange_actualCharacterRange_ (NSRange charRange, NSRangePointer actualCharRange) - { - OS.objc_msgSend(this.id_, OS.sel_invalidateLayoutForCharacterRange_1actualCharacterRange_1, charRange, actualCharRange); - } - - public void invalidateLayoutForCharacterRange_isSoft_actualCharacterRange_ (NSRange charRange, bool flag, NSRangePointer actualCharRange) - { - OS.objc_msgSend(this.id_, OS.sel_invalidateLayoutForCharacterRange_1isSoft_1actualCharacterRange_1, charRange, flag, actualCharRange); - } - - public bool isValidGlyphIndex (NSUInteger glyphIndex) - { - return OS.objc_msgSend(this.id_, OS.sel_isValidGlyphIndex_1, glyphIndex) !is null; - } - - public bool layoutManagerOwnsFirstResponderInWindow (NSWindow window) - { - return OS.objc_msgSend(this.id_, OS.sel_layoutManagerOwnsFirstResponderInWindow_1, window !is null ? window.id_ : null) !is null; - } - - public NSUInteger layoutOptions () - { - return cast(NSUInteger) OS.objc_msgSend(this.id_, OS.sel_layoutOptions); - } +public NSRect lineFragmentUsedRectForGlyphAtIndex(NSUInteger glyphIndex, NSRangePointer effectiveGlyphRange, bool flag) { + NSRect result = NSRect(); + OS.objc_msgSend_stret(result, this.id, OS.sel_lineFragmentUsedRectForGlyphAtIndex_effectiveRange_withoutAdditionalLayout_, glyphIndex, effectiveGlyphRange, flag); + return result; +} - public NSRect layoutRectForTextBlock_atIndex_effectiveRange_ (NSTextBlock block, NSUInteger glyphIndex, NSRangePointer effectiveGlyphRange) - { - NSRect result; - OS.objc_msgSend_stret(&result, this.id_, OS.sel_layoutRectForTextBlock_1atIndex_1effectiveRange_1, block !is null ? block.id_ : null, - glyphIndex, effectiveGlyphRange); - return result; - } - - public NSRect layoutRectForTextBlock_glyphRange_ (NSTextBlock block, NSRange glyphRange) - { - NSRect result; - OS.objc_msgSend_stret(&result, this.id_, OS.sel_layoutRectForTextBlock_1glyphRange_1, block !is null ? block.id_ : null, glyphRange); - return result; - } - - public NSRect lineFragmentRectForGlyphAtIndex_effectiveRange_ (NSUInteger glyphIndex, NSRangePointer effectiveGlyphRange) - { - NSRect result; - OS.objc_msgSend_stret(&result, this.id_, OS.sel_lineFragmentRectForGlyphAtIndex_1effectiveRange_1, glyphIndex, effectiveGlyphRange); - return result; - } - - public NSRect lineFragmentRectForGlyphAtIndex_effectiveRange_withoutAdditionalLayout_ (NSUInteger glyphIndex, NSRangePointer effectiveGlyphRange, - bool flag) - { - NSRect result; - OS.objc_msgSend_stret(&result, this.id_, OS.sel_lineFragmentRectForGlyphAtIndex_1effectiveRange_1withoutAdditionalLayout_1, glyphIndex, - effectiveGlyphRange, flag); - return result; - } - - public NSRect lineFragmentUsedRectForGlyphAtIndex_effectiveRange_ (NSUInteger glyphIndex, NSRangePointer effectiveGlyphRange) - { - NSRect result; - OS.objc_msgSend_stret(&result, this.id_, OS.sel_lineFragmentUsedRectForGlyphAtIndex_1effectiveRange_1, glyphIndex, effectiveGlyphRange); - return result; - } - - public NSRect lineFragmentUsedRectForGlyphAtIndex_effectiveRange_withoutAdditionalLayout_ (NSUInteger glyphIndex, - NSRangePointer effectiveGlyphRange, bool flag) - { - NSRect result; - OS.objc_msgSend_stret(&result, this.id_, OS.sel_lineFragmentUsedRectForGlyphAtIndex_1effectiveRange_1withoutAdditionalLayout_1, glyphIndex, - effectiveGlyphRange, flag); - return result; - } - - public NSPoint locationForGlyphAtIndex (NSUInteger glyphIndex) - { - NSPoint result; - OS.objc_msgSend_struct(&result, this.id_, OS.sel_locationForGlyphAtIndex_1, glyphIndex); - return result; - } - - public bool notShownAttributeForGlyphAtIndex (NSUInteger glyphIndex) - { - return OS.objc_msgSend(this.id_, OS.sel_notShownAttributeForGlyphAtIndex_1, glyphIndex) !is null; - } - - public NSUInteger numberOfGlyphs () - { - return cast(NSUInteger) OS.objc_msgSend(this.id_, OS.sel_numberOfGlyphs); - } - - public NSRange rangeOfNominallySpacedGlyphsContainingIndex (NSUInteger glyphIndex) - { - NSRange result; - OS.objc_msgSend_stret(&result, this.id_, OS.sel_rangeOfNominallySpacedGlyphsContainingIndex_1, glyphIndex); - return result; - } - - public NSRectArray rectArrayForCharacterRange (NSRange charRange, NSRange selCharRange, NSTextContainer container, NSUInteger* rectCount) - { - return cast(NSRectArray) OS.objc_msgSend(this.id_, OS.sel_rectArrayForCharacterRange_1withinSelectedCharacterRange_1inTextContainer_1rectCount_1, charRange, - selCharRange, container !is null ? container.id_ : null, rectCount); - } - - public NSRectArray rectArrayForGlyphRange (NSRange glyphRange, NSRange selGlyphRange, NSTextContainer container, NSUInteger* rectCount) - { - return cast(NSRectArray) OS.objc_msgSend(this.id_, OS.sel_rectArrayForGlyphRange_1withinSelectedGlyphRange_1inTextContainer_1rectCount_1, glyphRange, - selGlyphRange, container !is null ? container.id_ : null, rectCount); - } - - public void removeTemporaryAttribute (NSString attrName, NSRange charRange) - { - OS.objc_msgSend(this.id_, OS.sel_removeTemporaryAttribute_1forCharacterRange_1, attrName !is null ? attrName.id_ : null, charRange); - } - - public void removeTextContainerAtIndex (NSUInteger index) - { - OS.objc_msgSend(this.id_, OS.sel_removeTextContainerAtIndex_1, index); - } +public NSPoint locationForGlyphAtIndex(NSUInteger glyphIndex) { + NSPoint result = NSPoint(); + OS.objc_msgSend_stret(result, this.id, OS.sel_locationForGlyphAtIndex_, glyphIndex); + return result; +} - public void replaceGlyphAtIndex (NSUInteger glyphIndex, NSGlyph newGlyph) - { - OS.objc_msgSend(this.id_, OS.sel_replaceGlyphAtIndex_1withGlyph_1, glyphIndex, newGlyph); - } - - public void replaceTextStorage (NSTextStorage newTextStorage) - { - OS.objc_msgSend(this.id_, OS.sel_replaceTextStorage_1, newTextStorage !is null ? newTextStorage.id_ : null); - } - - public NSView rulerAccessoryViewForTextView (NSTextView view, NSParagraphStyle style, NSRulerView ruler, bool isEnabled) - { - objc.id result = OS.objc_msgSend(this.id_, OS.sel_rulerAccessoryViewForTextView_1paragraphStyle_1ruler_1enabled_1, - view !is null ? view.id_ : null, style !is null ? style.id_ : null, ruler !is null ? ruler.id_ : null, isEnabled); - return result !is null ? new NSView(result) : null; - } - - public NSArray rulerMarkersForTextView (NSTextView view, NSParagraphStyle style, NSRulerView ruler) - { - objc.id result = OS.objc_msgSend(this.id_, OS.sel_rulerMarkersForTextView_1paragraphStyle_1ruler_1, view !is null ? view.id_ : null, - style !is null ? style.id_ : null, ruler !is null ? ruler.id_ : null); - return result !is null ? new NSArray(result) : null; - } - - public void setAllowsNonContiguousLayout (bool flag) - { - OS.objc_msgSend(this.id_, OS.sel_setAllowsNonContiguousLayout_1, flag); - } - - public void setAttachmentSize (NSSize attachmentSize, NSRange glyphRange) - { - OS.objc_msgSend(this.id_, OS.sel_setAttachmentSize_1forGlyphRange_1, attachmentSize, glyphRange); - } - - public void setBackgroundLayoutEnabled (bool flag) - { - OS.objc_msgSend(this.id_, OS.sel_setBackgroundLayoutEnabled_1, flag); - } - - public void setBoundsRect (NSRect rect, NSTextBlock block, NSRange glyphRange) - { - OS.objc_msgSend(this.id_, OS.sel_setBoundsRect_1forTextBlock_1glyphRange_1, rect, block !is null ? block.id_ : null, glyphRange); - } - - public void setCharacterIndex (NSUInteger charIndex, NSUInteger glyphIndex) - { - OS.objc_msgSend(this.id_, OS.sel_setCharacterIndex_1forGlyphAtIndex_1, charIndex, glyphIndex); - } +public NSUInteger numberOfGlyphs() { + return cast(NSUInteger) OS.objc_msgSend(this.id, OS.sel_numberOfGlyphs); +} - public void setDefaultAttachmentScaling (NSImageScaling scaling) - { - OS.objc_msgSend(this.id_, OS.sel_setDefaultAttachmentScaling_1, scaling); - } - - public void setDelegate (id delegatee) - { - OS.objc_msgSend(this.id_, OS.sel_setDelegate_1, delegatee !is null ? delegatee.id_ : null); - } - - public void setDrawsOutsideLineFragment (bool flag, NSUInteger glyphIndex) - { - OS.objc_msgSend(this.id_, OS.sel_setDrawsOutsideLineFragment_1forGlyphAtIndex_1, flag, glyphIndex); - } - - public void setExtraLineFragmentRect (NSRect fragmentRect, NSRect usedRect, NSTextContainer container) - { - OS.objc_msgSend(this.id_, OS.sel_setExtraLineFragmentRect_1usedRect_1textContainer_1, fragmentRect, usedRect, - container !is null ? container.id_ : null); - } - - public void setGlyphGenerator (NSGlyphGenerator glyphGenerator) - { - OS.objc_msgSend(this.id_, OS.sel_setGlyphGenerator_1, glyphGenerator !is null ? glyphGenerator.id_ : null); - } - - public void setHyphenationFactor (float factor) - { - OS.objc_msgSend(this.id_, OS.sel_setHyphenationFactor_1, factor); - } - - public void setIntAttribute (NSInteger attributeTag, NSInteger val, NSUInteger glyphIndex) - { - OS.objc_msgSend(this.id_, OS.sel_setIntAttribute_1value_1forGlyphAtIndex_1, attributeTag, val, glyphIndex); - } - - public void setLayoutRect (NSRect rect, NSTextBlock block, NSRange glyphRange) - { - OS.objc_msgSend(this.id_, OS.sel_setLayoutRect_1forTextBlock_1glyphRange_1, rect, block !is null ? block.id_ : null, glyphRange); - } - - public void setLineFragmentRect (NSRect fragmentRect, NSRange glyphRange, NSRect usedRect) - { - OS.objc_msgSend(this.id_, OS.sel_setLineFragmentRect_1forGlyphRange_1usedRect_1, fragmentRect, glyphRange, usedRect); - } - - public void setLocation (NSPoint location, NSRange glyphRange) - { - OS.objc_msgSend(this.id_, OS.sel_setLocation_1forStartOfGlyphRange_1, location, glyphRange); - } +public void removeTemporaryAttribute(NSString attrName, NSRange charRange) { + OS.objc_msgSend(this.id, OS.sel_removeTemporaryAttribute_forCharacterRange_, attrName !is null ? attrName.id : null, charRange); +} - public void setLocations (NSPointArray locations, NSUInteger* glyphIndexes, NSUInteger count, NSRange glyphRange) - { - OS.objc_msgSend(this.id_, OS.sel_setLocations_1startingGlyphIndexes_1count_1forGlyphRange_1, locations, glyphIndexes, count, glyphRange); - } - - public void setNotShownAttribute (bool flag, NSUInteger glyphIndex) - { - OS.objc_msgSend(this.id_, OS.sel_setNotShownAttribute_1forGlyphAtIndex_1, flag, glyphIndex); - } - - public void setShowsControlCharacters (bool flag) - { - OS.objc_msgSend(this.id_, OS.sel_setShowsControlCharacters_1, flag); - } - - public void setShowsInvisibleCharacters (bool flag) - { - OS.objc_msgSend(this.id_, OS.sel_setShowsInvisibleCharacters_1, flag); - } - - public void setTemporaryAttributes (NSDictionary attrs, NSRange charRange) - { - OS.objc_msgSend(this.id_, OS.sel_setTemporaryAttributes_1forCharacterRange_1, attrs !is null ? attrs.id_ : null, charRange); - } - - public void setTextContainer (NSTextContainer container, NSRange glyphRange) - { - OS.objc_msgSend(this.id_, OS.sel_setTextContainer_1forGlyphRange_1, container !is null ? container.id_ : null, glyphRange); - } - - public void setTextStorage (NSTextStorage textStorage) - { - OS.objc_msgSend(this.id_, OS.sel_setTextStorage_1, textStorage !is null ? textStorage.id_ : null); - } - - public void setTypesetter (NSTypesetter typesetter) - { - OS.objc_msgSend(this.id_, OS.sel_setTypesetter_1, typesetter !is null ? typesetter.id_ : null); - } - - public void setTypesetterBehavior (NSTypesetterBehavior theBehavior) - { - OS.objc_msgSend(this.id_, OS.sel_setTypesetterBehavior_1, theBehavior); - } - - public void setUsesFontLeading (bool flag) - { - OS.objc_msgSend(this.id_, OS.sel_setUsesFontLeading_1, flag); - } - - public void setUsesScreenFonts (bool flag) - { - OS.objc_msgSend(this.id_, OS.sel_setUsesScreenFonts_1, flag); - } - - public void showAttachmentCell (NSCell cell, NSRect rect, NSUInteger attachmentIndex) - { - OS.objc_msgSend(this.id_, OS.sel_showAttachmentCell_1inRect_1characterIndex_1, cell !is null ? cell.id_ : null, rect, attachmentIndex); - } - - public void showPackedGlyphs (byte* glyphs, NSUInteger glyphLen, NSRange glyphRange, NSPoint point, NSFont font, NSColor color, - NSSize printingAdjustment) - { - OS.objc_msgSend(this.id_, OS.sel_showPackedGlyphs_1length_1glyphRange_1atPoint_1font_1color_1printingAdjustment_1, glyphs, glyphLen, - glyphRange, point, font !is null ? font.id_ : null, color !is null ? color.id_ : null, printingAdjustment); - } - - public bool showsControlCharacters () - { - return OS.objc_msgSend(this.id_, OS.sel_showsControlCharacters) !is null; - } - - public bool showsInvisibleCharacters () - { - return OS.objc_msgSend(this.id_, OS.sel_showsInvisibleCharacters) !is null; - } - - public void strikethroughGlyphRange (NSRange glyphRange, NSInteger strikethroughVal, NSRect lineRect, NSRange lineGlyphRange, - NSPoint containerOrigin) - { - OS.objc_msgSend(this.id_, OS.sel_strikethroughGlyphRange_1strikethroughType_1lineFragmentRect_1lineFragmentGlyphRange_1containerOrigin_1, - glyphRange, strikethroughVal, lineRect, lineGlyphRange, containerOrigin); - } - - public NSFont substituteFontForFont (NSFont originalFont) - { - objc.id result = OS.objc_msgSend(this.id_, OS.sel_substituteFontForFont_1, originalFont !is null ? originalFont.id_ : null); - return result !is null ? new NSFont(result) : null; - } - - public id temporaryAttribute_atCharacterIndex_effectiveRange_ (NSString attrName, NSUInteger location, NSRangePointer range) - { - objc.id result = OS.objc_msgSend(this.id_, OS.sel_temporaryAttribute_1atCharacterIndex_1effectiveRange_1, - attrName !is null ? attrName.id_ : null, location, range); - return result !is null ? new id(result) : null; - } +public void setLineFragmentRect(NSRect fragmentRect, NSRange glyphRange, NSRect usedRect) { + OS.objc_msgSend(this.id, OS.sel_setLineFragmentRect_forGlyphRange_usedRect_, fragmentRect, glyphRange, usedRect); +} - public id temporaryAttribute_atCharacterIndex_longestEffectiveRange_inRange_ (NSString attrName, NSUInteger location, NSRangePointer range, - NSRange rangeLimit) - { - objc.id result = OS.objc_msgSend(this.id_, OS.sel_temporaryAttribute_1atCharacterIndex_1longestEffectiveRange_1inRange_1, - attrName !is null ? attrName.id_ : null, location, range, rangeLimit); - return result !is null ? new id(result) : null; - } - - public NSDictionary temporaryAttributesAtCharacterIndex_effectiveRange_ (NSUInteger charIndex, NSRangePointer effectiveCharRange) - { - objc.id result = OS.objc_msgSend(this.id_, OS.sel_temporaryAttributesAtCharacterIndex_1effectiveRange_1, charIndex, effectiveCharRange); - return result !is null ? new NSDictionary(result) : null; - } - - public NSDictionary temporaryAttributesAtCharacterIndex_longestEffectiveRange_inRange_ (NSUInteger location, NSRangePointer range, - NSRange rangeLimit) - { - objc.id result = OS.objc_msgSend(this.id_, OS.sel_temporaryAttributesAtCharacterIndex_1longestEffectiveRange_1inRange_1, location, range, - rangeLimit); - return result !is null ? new NSDictionary(result) : null; - } - - public void textContainerChangedGeometry (NSTextContainer container) - { - OS.objc_msgSend(this.id_, OS.sel_textContainerChangedGeometry_1, container !is null ? container.id_ : null); - } - - public void textContainerChangedTextView (NSTextContainer container) - { - OS.objc_msgSend(this.id_, OS.sel_textContainerChangedTextView_1, container !is null ? container.id_ : null); - } - - public NSTextContainer textContainerForGlyphAtIndex_effectiveRange_ (NSUInteger glyphIndex, NSRangePointer effectiveGlyphRange) - { - objc.id result = OS.objc_msgSend(this.id_, OS.sel_textContainerForGlyphAtIndex_1effectiveRange_1, glyphIndex, effectiveGlyphRange); - return result !is null ? new NSTextContainer(result) : null; - } - - public NSTextContainer textContainerForGlyphAtIndex_effectiveRange_withoutAdditionalLayout_ (NSUInteger glyphIndex, - NSRangePointer effectiveGlyphRange, bool flag) - { - objc.id result = OS.objc_msgSend(this.id_, OS.sel_textContainerForGlyphAtIndex_1effectiveRange_1withoutAdditionalLayout_1, glyphIndex, - effectiveGlyphRange, flag); - return result !is null ? new NSTextContainer(result) : null; - } - - public NSArray textContainers () - { - objc.id result = OS.objc_msgSend(this.id_, OS.sel_textContainers); - return result !is null ? new NSArray(result) : null; - } +public NSTypesetter typesetter() { + objc.id result = OS.objc_msgSend(this.id, OS.sel_typesetter); + return result !is null ? new NSTypesetter(result) : null; +} - public NSTextStorage textStorage () - { - objc.id result = OS.objc_msgSend(this.id_, OS.sel_textStorage); - return result !is null ? new NSTextStorage(result) : null; - } - - public void textStorage_edited_range_changeInLength_invalidatedRange_ (NSTextStorage str, NSUInteger editedMask, NSRange newCharRange, - NSInteger delta, NSRange invalidatedCharRange) - { - OS.objc_msgSend(this.id_, OS.sel_textStorage_1edited_1range_1changeInLength_1invalidatedRange_1, str !is null ? str.id_ : null, editedMask, - newCharRange, delta, invalidatedCharRange); - } - - public NSTextView textViewForBeginningOfSelection () - { - objc.id result = OS.objc_msgSend(this.id_, OS.sel_textViewForBeginningOfSelection); - return result !is null ? new NSTextView(result) : null; - } - - public NSTypesetter typesetter () - { - objc.id result = OS.objc_msgSend(this.id_, OS.sel_typesetter); - return result !is null ? new NSTypesetter(result) : null; - } - - public NSTypesetterBehavior typesetterBehavior () - { - return cast(NSTypesetterBehavior) OS.objc_msgSend(this.id_, OS.sel_typesetterBehavior); - } - - public void underlineGlyphRange (NSRange glyphRange, NSInteger underlineVal, NSRect lineRect, NSRange lineGlyphRange, NSPoint containerOrigin) - { - OS.objc_msgSend(this.id_, OS.sel_underlineGlyphRange_1underlineType_1lineFragmentRect_1lineFragmentGlyphRange_1containerOrigin_1, glyphRange, - underlineVal, lineRect, lineGlyphRange, containerOrigin); - } - - public NSRect usedRectForTextContainer (NSTextContainer container) - { - NSRect result; - OS.objc_msgSend_stret(&result, this.id_, OS.sel_usedRectForTextContainer_1, container !is null ? container.id_ : null); - return result; - } - - public bool usesFontLeading () - { - return OS.objc_msgSend(this.id_, OS.sel_usesFontLeading) !is null; - } - - public bool usesScreenFonts () - { - return OS.objc_msgSend(this.id_, OS.sel_usesScreenFonts) !is null; - } +public NSRect usedRectForTextContainer(NSTextContainer container) { + NSRect result = NSRect(); + OS.objc_msgSend_stret(result, this.id, OS.sel_usedRectForTextContainer_, container !is null ? container.id : null); + return result; +} }