Mercurial > projects > dstep
view dstep/appkit/NSAttributedString.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 |
line wrap: on
line source
/** * Copyright: Copyright (c) 2009 Jacob Carlborg. * Authors: Jacob Carlborg * Version: Initial created: Sep 24, 2009 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) */ module dstep.appkit.NSAttributedString; import dstep.appkit.AppKitDefines; import dstep.appkit.NSFileWrapper; import dstep.appkit.NSFontManager; import dstep.appkit.NSText; import dstep.appkit.NSTextList; import dstep.appkit.NSTextTable; import dstep.foundation.NSAttributedString; import dstep.foundation.NSObjCRuntime; import dstep.foundation.NSString; import dstep.foundation.NSURL; import dstep.objc.bridge.Bridge; import dstep.objc.objc; import bindings = dstep.appkit.NSAttributedString_bindings; extern (C) { extern { NSUInteger NSUnderlineByWordMask; NSUInteger NSUnderlineStrikethroughMask; } } private { NSString NSFontAttributeName_; NSString NSParagraphStyleAttributeName_; NSString NSForegroundColorAttributeName_; NSString NSUnderlineStyleAttributeName_; NSString NSSuperscriptAttributeName_; NSString NSBackgroundColorAttributeName_; NSString NSAttachmentAttributeName_; NSString NSLigatureAttributeName_; NSString NSBaselineOffsetAttributeName_; NSString NSKernAttributeName_; NSString NSLinkAttributeName_; NSString NSStrokeWidthAttributeName_; NSString NSStrokeColorAttributeName_; NSString NSUnderlineColorAttributeName_; NSString NSStrikethroughStyleAttributeName_; NSString NSStrikethroughColorAttributeName_; NSString NSShadowAttributeName_; NSString NSObliquenessAttributeName_; NSString NSExpansionAttributeName_; NSString NSCursorAttributeName_; NSString NSToolTipAttributeName_; NSString NSCharacterShapeAttributeName_; NSString NSGlyphInfoAttributeName_; NSString NSMarkedClauseSegmentAttributeName_; NSString NSSpellingStateAttributeName_; NSString NSPlainTextDocumentType_; NSString NSRTFTextDocumentType_; NSString NSRTFDTextDocumentType_; NSString NSMacSimpleTextDocumentType_; NSString NSHTMLTextDocumentType_; NSString NSDocFormatTextDocumentType_; NSString NSWordMLTextDocumentType_; NSString NSWebArchiveTextDocumentType_; NSString NSOfficeOpenXMLTextDocumentType_; NSString NSOpenDocumentTextDocumentType_; NSString NSPaperSizeDocumentAttribute_; NSString NSLeftMarginDocumentAttribute_; NSString NSRightMarginDocumentAttribute_; NSString NSTopMarginDocumentAttribute_; NSString NSBottomMarginDocumentAttribute_; NSString NSViewSizeDocumentAttribute_; NSString NSViewZoomDocumentAttribute_; NSString NSViewModeDocumentAttribute_; NSString NSDocumentTypeDocumentAttribute_; NSString NSReadOnlyDocumentAttribute_; NSString NSConvertedDocumentAttribute_; NSString NSCocoaVersionDocumentAttribute_; NSString NSBackgroundColorDocumentAttribute_; NSString NSHyphenationFactorDocumentAttribute_; NSString NSDefaultTabIntervalDocumentAttribute_; NSString NSCharacterEncodingDocumentAttribute_; NSString NSTitleDocumentAttribute_; NSString NSCompanyDocumentAttribute_; NSString NSCopyrightDocumentAttribute_; NSString NSSubjectDocumentAttribute_; NSString NSAuthorDocumentAttribute_; NSString NSKeywordsDocumentAttribute_; NSString NSCommentDocumentAttribute_; NSString NSEditorDocumentAttribute_; NSString NSCreationTimeDocumentAttribute_; NSString NSModificationTimeDocumentAttribute_; NSString NSExcludedElementsDocumentAttribute_; NSString NSTextEncodingNameDocumentAttribute_; NSString NSPrefixSpacesDocumentAttribute_; NSString NSDocumentTypeDocumentOption_; NSString NSDefaultAttributesDocumentOption_; NSString NSCharacterEncodingDocumentOption_; NSString NSTextEncodingNameDocumentOption_; NSString NSBaseURLDocumentOption_; NSString NSTimeoutDocumentOption_; NSString NSWebPreferencesDocumentOption_; NSString NSWebResourceLoadDelegateDocumentOption_; NSString NSTextSizeMultiplierDocumentOption_; } NSString NSFontAttributeName () { if (NSFontAttributeName_) return NSFontAttributeName_; return NSFontAttributeName_ = new NSString(bindings.NSFontAttributeName); } NSString NSParagraphStyleAttributeName () { if (NSParagraphStyleAttributeName_) return NSParagraphStyleAttributeName_; return NSParagraphStyleAttributeName_ = new NSString(bindings.NSParagraphStyleAttributeName); } NSString NSForegroundColorAttributeName () { if (NSForegroundColorAttributeName_) return NSForegroundColorAttributeName_; return NSForegroundColorAttributeName_ = new NSString(bindings.NSForegroundColorAttributeName); } NSString NSUnderlineStyleAttributeName () { if (NSUnderlineStyleAttributeName_) return NSUnderlineStyleAttributeName_; return NSUnderlineStyleAttributeName_ = new NSString(bindings.NSUnderlineStyleAttributeName); } NSString NSSuperscriptAttributeName () { if (NSSuperscriptAttributeName_) return NSSuperscriptAttributeName_; return NSSuperscriptAttributeName_ = new NSString(bindings.NSSuperscriptAttributeName); } NSString NSBackgroundColorAttributeName () { if (NSBackgroundColorAttributeName_) return NSBackgroundColorAttributeName_; return NSBackgroundColorAttributeName_ = new NSString(bindings.NSBackgroundColorAttributeName); } NSString NSAttachmentAttributeName () { if (NSAttachmentAttributeName_) return NSAttachmentAttributeName_; return NSAttachmentAttributeName_ = new NSString(bindings.NSAttachmentAttributeName); } NSString NSLigatureAttributeName () { if (NSLigatureAttributeName_) return NSLigatureAttributeName_; return NSLigatureAttributeName_ = new NSString(bindings.NSLigatureAttributeName); } NSString NSBaselineOffsetAttributeName () { if (NSBaselineOffsetAttributeName_) return NSBaselineOffsetAttributeName_; return NSBaselineOffsetAttributeName_ = new NSString(bindings.NSBaselineOffsetAttributeName); } NSString NSKernAttributeName () { if (NSKernAttributeName_) return NSKernAttributeName_; return NSKernAttributeName_ = new NSString(bindings.NSKernAttributeName); } NSString NSLinkAttributeName () { if (NSLinkAttributeName_) return NSLinkAttributeName_; return NSLinkAttributeName_ = new NSString(bindings.NSLinkAttributeName); } NSString NSStrokeWidthAttributeName () { if (NSStrokeWidthAttributeName_) return NSStrokeWidthAttributeName_; return NSStrokeWidthAttributeName_ = new NSString(bindings.NSStrokeWidthAttributeName); } NSString NSStrokeColorAttributeName () { if (NSStrokeColorAttributeName_) return NSStrokeColorAttributeName_; return NSStrokeColorAttributeName_ = new NSString(bindings.NSStrokeColorAttributeName); } NSString NSUnderlineColorAttributeName () { if (NSUnderlineColorAttributeName_) return NSUnderlineColorAttributeName_; return NSUnderlineColorAttributeName_ = new NSString(bindings.NSUnderlineColorAttributeName); } NSString NSStrikethroughStyleAttributeName () { if (NSStrikethroughStyleAttributeName_) return NSStrikethroughStyleAttributeName_; return NSStrikethroughStyleAttributeName_ = new NSString(bindings.NSStrikethroughStyleAttributeName); } NSString NSStrikethroughColorAttributeName () { if (NSStrikethroughColorAttributeName_) return NSStrikethroughColorAttributeName_; return NSStrikethroughColorAttributeName_ = new NSString(bindings.NSStrikethroughColorAttributeName); } NSString NSShadowAttributeName () { if (NSShadowAttributeName_) return NSShadowAttributeName_; return NSShadowAttributeName_ = new NSString(bindings.NSShadowAttributeName); } NSString NSObliquenessAttributeName () { if (NSObliquenessAttributeName_) return NSObliquenessAttributeName_; return NSObliquenessAttributeName_ = new NSString(bindings.NSObliquenessAttributeName); } NSString NSExpansionAttributeName () { if (NSExpansionAttributeName_) return NSExpansionAttributeName_; return NSExpansionAttributeName_ = new NSString(bindings.NSExpansionAttributeName); } NSString NSCursorAttributeName () { if (NSCursorAttributeName_) return NSCursorAttributeName_; return NSCursorAttributeName_ = new NSString(bindings.NSCursorAttributeName); } NSString NSToolTipAttributeName () { if (NSToolTipAttributeName_) return NSToolTipAttributeName_; return NSToolTipAttributeName_ = new NSString(bindings.NSToolTipAttributeName); } NSString NSCharacterShapeAttributeName () { if (NSCharacterShapeAttributeName_) return NSCharacterShapeAttributeName_; return NSCharacterShapeAttributeName_ = new NSString(bindings.NSCharacterShapeAttributeName); } NSString NSGlyphInfoAttributeName () { if (NSGlyphInfoAttributeName_) return NSGlyphInfoAttributeName_; return NSGlyphInfoAttributeName_ = new NSString(bindings.NSGlyphInfoAttributeName); } NSString NSMarkedClauseSegmentAttributeName () { if (NSMarkedClauseSegmentAttributeName_) return NSMarkedClauseSegmentAttributeName_; return NSMarkedClauseSegmentAttributeName_ = new NSString(bindings.NSMarkedClauseSegmentAttributeName); } NSString NSSpellingStateAttributeName () { if (NSSpellingStateAttributeName_) return NSSpellingStateAttributeName_; return NSSpellingStateAttributeName_ = new NSString(bindings.NSSpellingStateAttributeName); } NSString NSPlainTextDocumentType () { if (NSPlainTextDocumentType_) return NSPlainTextDocumentType_; return NSPlainTextDocumentType_ = new NSString(bindings.NSPlainTextDocumentType); } NSString NSRTFTextDocumentType () { if (NSRTFTextDocumentType_) return NSRTFTextDocumentType_; return NSRTFTextDocumentType_ = new NSString(bindings.NSRTFTextDocumentType); } NSString NSRTFDTextDocumentType () { if (NSRTFDTextDocumentType_) return NSRTFDTextDocumentType_; return NSRTFDTextDocumentType_ = new NSString(bindings.NSRTFDTextDocumentType); } NSString NSMacSimpleTextDocumentType () { if (NSMacSimpleTextDocumentType_) return NSMacSimpleTextDocumentType_; return NSMacSimpleTextDocumentType_ = new NSString(bindings.NSMacSimpleTextDocumentType); } NSString NSHTMLTextDocumentType () { if (NSHTMLTextDocumentType_) return NSHTMLTextDocumentType_; return NSHTMLTextDocumentType_ = new NSString(bindings.NSHTMLTextDocumentType); } NSString NSDocFormatTextDocumentType () { if (NSDocFormatTextDocumentType_) return NSDocFormatTextDocumentType_; return NSDocFormatTextDocumentType_ = new NSString(bindings.NSDocFormatTextDocumentType); } NSString NSWordMLTextDocumentType () { if (NSWordMLTextDocumentType_) return NSWordMLTextDocumentType_; return NSWordMLTextDocumentType_ = new NSString(bindings.NSWordMLTextDocumentType); } NSString NSWebArchiveTextDocumentType () { if (NSWebArchiveTextDocumentType_) return NSWebArchiveTextDocumentType_; return NSWebArchiveTextDocumentType_ = new NSString(bindings.NSWebArchiveTextDocumentType); } NSString NSOfficeOpenXMLTextDocumentType () { if (NSOfficeOpenXMLTextDocumentType_) return NSOfficeOpenXMLTextDocumentType_; return NSOfficeOpenXMLTextDocumentType_ = new NSString(bindings.NSOfficeOpenXMLTextDocumentType); } NSString NSOpenDocumentTextDocumentType () { if (NSOpenDocumentTextDocumentType_) return NSOpenDocumentTextDocumentType_; return NSOpenDocumentTextDocumentType_ = new NSString(bindings.NSOpenDocumentTextDocumentType); } NSString NSPaperSizeDocumentAttribute () { if (NSPaperSizeDocumentAttribute_) return NSPaperSizeDocumentAttribute_; return NSPaperSizeDocumentAttribute_ = new NSString(bindings.NSPaperSizeDocumentAttribute); } NSString NSLeftMarginDocumentAttribute () { if (NSLeftMarginDocumentAttribute_) return NSLeftMarginDocumentAttribute_; return NSLeftMarginDocumentAttribute_ = new NSString(bindings.NSLeftMarginDocumentAttribute); } NSString NSRightMarginDocumentAttribute () { if (NSRightMarginDocumentAttribute_) return NSRightMarginDocumentAttribute_; return NSRightMarginDocumentAttribute_ = new NSString(bindings.NSRightMarginDocumentAttribute); } NSString NSTopMarginDocumentAttribute () { if (NSTopMarginDocumentAttribute_) return NSTopMarginDocumentAttribute_; return NSTopMarginDocumentAttribute_ = new NSString(bindings.NSTopMarginDocumentAttribute); } NSString NSBottomMarginDocumentAttribute () { if (NSBottomMarginDocumentAttribute_) return NSBottomMarginDocumentAttribute_; return NSBottomMarginDocumentAttribute_ = new NSString(bindings.NSBottomMarginDocumentAttribute); } NSString NSViewSizeDocumentAttribute () { if (NSViewSizeDocumentAttribute_) return NSViewSizeDocumentAttribute_; return NSViewSizeDocumentAttribute_ = new NSString(bindings.NSViewSizeDocumentAttribute); } NSString NSViewZoomDocumentAttribute () { if (NSViewZoomDocumentAttribute_) return NSViewZoomDocumentAttribute_; return NSViewZoomDocumentAttribute_ = new NSString(bindings.NSViewZoomDocumentAttribute); } NSString NSViewModeDocumentAttribute () { if (NSViewModeDocumentAttribute_) return NSViewModeDocumentAttribute_; return NSViewModeDocumentAttribute_ = new NSString(bindings.NSViewModeDocumentAttribute); } NSString NSDocumentTypeDocumentAttribute () { if (NSDocumentTypeDocumentAttribute_) return NSDocumentTypeDocumentAttribute_; return NSDocumentTypeDocumentAttribute_ = new NSString(bindings.NSDocumentTypeDocumentAttribute); } NSString NSReadOnlyDocumentAttribute () { if (NSReadOnlyDocumentAttribute_) return NSReadOnlyDocumentAttribute_; return NSReadOnlyDocumentAttribute_ = new NSString(bindings.NSReadOnlyDocumentAttribute); } NSString NSConvertedDocumentAttribute () { if (NSConvertedDocumentAttribute_) return NSConvertedDocumentAttribute_; return NSConvertedDocumentAttribute_ = new NSString(bindings.NSConvertedDocumentAttribute); } NSString NSCocoaVersionDocumentAttribute () { if (NSCocoaVersionDocumentAttribute_) return NSCocoaVersionDocumentAttribute_; return NSCocoaVersionDocumentAttribute_ = new NSString(bindings.NSCocoaVersionDocumentAttribute); } NSString NSBackgroundColorDocumentAttribute () { if (NSBackgroundColorDocumentAttribute_) return NSBackgroundColorDocumentAttribute_; return NSBackgroundColorDocumentAttribute_ = new NSString(bindings.NSBackgroundColorDocumentAttribute); } NSString NSHyphenationFactorDocumentAttribute () { if (NSHyphenationFactorDocumentAttribute_) return NSHyphenationFactorDocumentAttribute_; return NSHyphenationFactorDocumentAttribute_ = new NSString(bindings.NSHyphenationFactorDocumentAttribute); } NSString NSDefaultTabIntervalDocumentAttribute () { if (NSDefaultTabIntervalDocumentAttribute_) return NSDefaultTabIntervalDocumentAttribute_; return NSDefaultTabIntervalDocumentAttribute_ = new NSString(bindings.NSDefaultTabIntervalDocumentAttribute); } NSString NSCharacterEncodingDocumentAttribute () { if (NSCharacterEncodingDocumentAttribute_) return NSCharacterEncodingDocumentAttribute_; return NSCharacterEncodingDocumentAttribute_ = new NSString(bindings.NSCharacterEncodingDocumentAttribute); } NSString NSTitleDocumentAttribute () { if (NSTitleDocumentAttribute_) return NSTitleDocumentAttribute_; return NSTitleDocumentAttribute_ = new NSString(bindings.NSTitleDocumentAttribute); } NSString NSCompanyDocumentAttribute () { if (NSCompanyDocumentAttribute_) return NSCompanyDocumentAttribute_; return NSCompanyDocumentAttribute_ = new NSString(bindings.NSCompanyDocumentAttribute); } NSString NSCopyrightDocumentAttribute () { if (NSCopyrightDocumentAttribute_) return NSCopyrightDocumentAttribute_; return NSCopyrightDocumentAttribute_ = new NSString(bindings.NSCopyrightDocumentAttribute); } NSString NSSubjectDocumentAttribute () { if (NSSubjectDocumentAttribute_) return NSSubjectDocumentAttribute_; return NSSubjectDocumentAttribute_ = new NSString(bindings.NSSubjectDocumentAttribute); } NSString NSAuthorDocumentAttribute () { if (NSAuthorDocumentAttribute_) return NSAuthorDocumentAttribute_; return NSAuthorDocumentAttribute_ = new NSString(bindings.NSAuthorDocumentAttribute); } NSString NSKeywordsDocumentAttribute () { if (NSKeywordsDocumentAttribute_) return NSKeywordsDocumentAttribute_; return NSKeywordsDocumentAttribute_ = new NSString(bindings.NSKeywordsDocumentAttribute); } NSString NSCommentDocumentAttribute () { if (NSCommentDocumentAttribute_) return NSCommentDocumentAttribute_; return NSCommentDocumentAttribute_ = new NSString(bindings.NSCommentDocumentAttribute); } NSString NSEditorDocumentAttribute () { if (NSEditorDocumentAttribute_) return NSEditorDocumentAttribute_; return NSEditorDocumentAttribute_ = new NSString(bindings.NSEditorDocumentAttribute); } NSString NSCreationTimeDocumentAttribute () { if (NSCreationTimeDocumentAttribute_) return NSCreationTimeDocumentAttribute_; return NSCreationTimeDocumentAttribute_ = new NSString(bindings.NSCreationTimeDocumentAttribute); } NSString NSModificationTimeDocumentAttribute () { if (NSModificationTimeDocumentAttribute_) return NSModificationTimeDocumentAttribute_; return NSModificationTimeDocumentAttribute_ = new NSString(bindings.NSModificationTimeDocumentAttribute); } NSString NSExcludedElementsDocumentAttribute () { if (NSExcludedElementsDocumentAttribute_) return NSExcludedElementsDocumentAttribute_; return NSExcludedElementsDocumentAttribute_ = new NSString(bindings.NSExcludedElementsDocumentAttribute); } NSString NSTextEncodingNameDocumentAttribute () { if (NSTextEncodingNameDocumentAttribute_) return NSTextEncodingNameDocumentAttribute_; return NSTextEncodingNameDocumentAttribute_ = new NSString(bindings.NSTextEncodingNameDocumentAttribute); } NSString NSPrefixSpacesDocumentAttribute () { if (NSPrefixSpacesDocumentAttribute_) return NSPrefixSpacesDocumentAttribute_; return NSPrefixSpacesDocumentAttribute_ = new NSString(bindings.NSPrefixSpacesDocumentAttribute); } NSString NSDocumentTypeDocumentOption () { if (NSDocumentTypeDocumentOption_) return NSDocumentTypeDocumentOption_; return NSDocumentTypeDocumentOption_ = new NSString(bindings.NSDocumentTypeDocumentOption); } NSString NSDefaultAttributesDocumentOption () { if (NSDefaultAttributesDocumentOption_) return NSDefaultAttributesDocumentOption_; return NSDefaultAttributesDocumentOption_ = new NSString(bindings.NSDefaultAttributesDocumentOption); } NSString NSCharacterEncodingDocumentOption () { if (NSCharacterEncodingDocumentOption_) return NSCharacterEncodingDocumentOption_; return NSCharacterEncodingDocumentOption_ = new NSString(bindings.NSCharacterEncodingDocumentOption); } NSString NSTextEncodingNameDocumentOption () { if (NSTextEncodingNameDocumentOption_) return NSTextEncodingNameDocumentOption_; return NSTextEncodingNameDocumentOption_ = new NSString(bindings.NSTextEncodingNameDocumentOption); } NSString NSBaseURLDocumentOption () { if (NSBaseURLDocumentOption_) return NSBaseURLDocumentOption_; return NSBaseURLDocumentOption_ = new NSString(bindings.NSBaseURLDocumentOption); } NSString NSTimeoutDocumentOption () { if (NSTimeoutDocumentOption_) return NSTimeoutDocumentOption_; return NSTimeoutDocumentOption_ = new NSString(bindings.NSTimeoutDocumentOption); } NSString NSWebPreferencesDocumentOption () { if (NSWebPreferencesDocumentOption_) return NSWebPreferencesDocumentOption_; return NSWebPreferencesDocumentOption_ = new NSString(bindings.NSWebPreferencesDocumentOption); } NSString NSWebResourceLoadDelegateDocumentOption () { if (NSWebResourceLoadDelegateDocumentOption_) return NSWebResourceLoadDelegateDocumentOption_; return NSWebResourceLoadDelegateDocumentOption_ = new NSString(bindings.NSWebResourceLoadDelegateDocumentOption); } NSString NSTextSizeMultiplierDocumentOption () { if (NSTextSizeMultiplierDocumentOption_) return NSTextSizeMultiplierDocumentOption_; return NSTextSizeMultiplierDocumentOption_ = new NSString(bindings.NSTextSizeMultiplierDocumentOption); } enum { NSUnderlineStyleNone = 0x00, NSUnderlineStyleSingle = 0x01, NSUnderlineStyleThick = 0x02, NSUnderlineStyleDouble = 0x09 } enum { NSUnderlinePatternSolid = 0x0000, NSUnderlinePatternDot = 0x0100, NSUnderlinePatternDash = 0x0200, NSUnderlinePatternDashDot = 0x0300, NSUnderlinePatternDashDotDot = 0x0400 } enum { NSSpellingStateSpellingFlag = (1 << 0), NSSpellingStateGrammarFlag = (1 << 1) } enum { NSNoUnderlineStyle = 0, NSSingleUnderlineStyle } const TNSMutableAttributedStringKitAdditions = ` bool readFromURL (NSURL url, NSDictionary opts, ref NSDictionary dict, ref NSError error) { id __arg2; id __arg3; if (dict) __arg2 = dict.objcObject; if (error) __arg3 = error.objcObject; bool result = invokeObjcSelf!(bool, "readFromURL:options:documentAttributes:error:", NSURL, NSDictionary, id*, id*)(url, opts, &__arg2, &__arg3); if (__arg2) dict = new NSDictionary(__arg2); if (__arg3) error = new NSError(__arg3); return result; } bool readFromData (NSData data, NSDictionary opts, ref NSDictionary dict, ref NSError error) { id __arg2; id __arg3; if (dict) __arg2 = dict.objcObject; if (error) __arg3 = error.objcObject; bool result = invokeObjcSelf!(bool, "readFromData:options:documentAttributes:error:", NSData, NSDictionary, id*, id*)(data, opts, &__arg2, &__arg3); if (__arg2) dict = new NSDictionary(__arg2); if (__arg3) error = new NSError(__arg3); return result; } bool readFromURL (NSURL url, NSDictionary options, ref NSDictionary dict) { id __arg2; if (dict) __arg2 = dict.objcObject; bool result = invokeObjcSelf!(bool, "readFromURL:options:documentAttributes:", NSURL, NSDictionary, id*)(url, options, &__arg2); if (__arg2) dict = new NSDictionary(__arg2); return result; } bool readFromData (NSData data, NSDictionary options, ref NSDictionary dict) { id __arg2; if (dict) __arg2 = dict.objcObject; bool result = invokeObjcSelf!(bool, "readFromData:options:documentAttributes:", NSData, NSDictionary, id*)(data, options, &__arg2); if (__arg2) dict = new NSDictionary(__arg2); return result; } void superscriptRange (NSRange range) { return invokeObjcSelf!(void, "superscriptRange:", NSRange)(range); } void subscriptRange (NSRange range) { return invokeObjcSelf!(void, "subscriptRange:", NSRange)(range); } void unscriptRange (NSRange range) { return invokeObjcSelf!(void, "unscriptRange:", NSRange)(range); } void applyFontTraits (uint traitMask, NSRange range) { return invokeObjcSelf!(void, "applyFontTraits:range:", uint, NSRange)(traitMask, range); } void setAlignment (uint alignment, NSRange range) { return invokeObjcSelf!(void, "setAlignment:range:", uint, NSRange)(alignment, range); } void setBaseWritingDirection (int writingDirection, NSRange range) { return invokeObjcSelf!(void, "setBaseWritingDirection:range:", int, NSRange)(writingDirection, range); } void fixAttributesInRange (NSRange range) { return invokeObjcSelf!(void, "fixAttributesInRange:", NSRange)(range); } void fixFontAttributeInRange (NSRange range) { return invokeObjcSelf!(void, "fixFontAttributeInRange:", NSRange)(range); } void fixParagraphStyleAttributeInRange (NSRange range) { return invokeObjcSelf!(void, "fixParagraphStyleAttributeInRange:", NSRange)(range); } void fixAttachmentAttributeInRange (NSRange range) { return invokeObjcSelf!(void, "fixAttachmentAttributeInRange:", NSRange)(range); } ////mixin ObjcBindMethod!(readFromURL, bool, "readFromURL:options:documentAttributes:error:", NSURL, NSDictionary, ref NSDictionary, ref NSError); ////mixin ObjcBindMethod!(readFromData, bool, "readFromData:options:documentAttributes:error:", NSData, NSDictionary, ref NSDictionary, ref NSError); ////mixin ObjcBindMethod!(readFromURL, bool, "readFromURL:options:documentAttributes:", NSURL, NSDictionary, ref NSDictionary, ref NSError); ////mixin ObjcBindMethod!(readFromData, bool, "readFromData:options:documentAttributes:", NSData, NSDictionary, ref NSDictionary, ref NSError); //mixin ObjcBindMethod!(superscriptRange, "superscriptRange:"); //mixin ObjcBindMethod!(subscriptRange, "subscriptRange:"); //mixin ObjcBindMethod!(unscriptRange, "unscriptRange:"); //mixin ObjcBindMethod!(applyFontTraits, "applyFontTraits:range:"); //mixin ObjcBindMethod!(setAlignment, "setAlignment:range:"); //mixin ObjcBindMethod!(setBaseWritingDirection, "setBaseWritingDirection:range:"); //mixin ObjcBindMethod!(fixAttributesInRange, "fixAttributesInRange:"); //mixin ObjcBindMethod!(fixFontAttributeInRange, "fixFontAttributeInRange:"); //mixin ObjcBindMethod!(fixParagraphStyleAttributeInRange, "fixParagraphStyleAttributeInRange:"); //mixin ObjcBindMethod!(fixAttachmentAttributeInRange, "fixAttachmentAttributeInRange:"); `; const TNSExtendedAttributedString = ` //import dstep.appkit.NSAttributedString; Object attribute (NSString attrName, NSUInteger location, NSRangePointer range) { return invokeObjcSelf!(Object, "attribute:atIndex:effectiveRange:", NSString, NSUInteger, NSRangePointer)(attrName, location, range); } NSAttributedString attributedSubstringFromRange (NSRange range) { return invokeObjcSelf!(NSAttributedString, "attributedSubstringFromRange:", NSRange)(range); } NSDictionary attributesAtIndex (NSUInteger location, NSRangePointer range, NSRange rangeLimit) { return invokeObjcSelf!(NSDictionary, "attributesAtIndex:longestEffectiveRange:inRange:", NSUInteger, NSRangePointer, NSRange)(location, range, rangeLimit); } Object attribute (NSString attrName, NSUInteger location, NSRangePointer range, NSRange rangeLimit) { return invokeObjcSelf!(Object, "attribute:atIndex:longestEffectiveRange:inRange:", NSString, NSUInteger, NSRangePointer, NSRange)(attrName, location, range, rangeLimit); } bool isEqualToAttributedString (NSAttributedString other) { return invokeObjcSelf!(bool, "isEqualToAttributedString:", NSAttributedString)(other); } //mixin ObjcBindMethod!(attribute, "attribute:atIndex:effectiveRange:"); //mixin ObjcBindMethod!(attributedSubstringFromRange, "attributedSubstringFromRange:"); //mixin ObjcBindMethod!(attributesAtIndex, "attributesAtIndex:longestEffectiveRange:inRange:"); //mixin ObjcBindMethod!(attribute, "attribute:atIndex:longestEffectiveRange:inRange:"); //mixin ObjcBindMethod!(isEqualToAttributedString, "isEqualToAttributedString:"); //mixin ObjcBindMethod!(initWithString, "initWithString:"); //mixin ObjcBindMethod!(initWithString, "initWithString:attributes:"); //mixin ObjcBindMethod!(initWithAttributedString, "initWithAttributedString:"); `; const TNSDeprecatedKitAdditions = ` static NSArray textFileTypes () { return invokeObjcSelfClass!(NSArray, "textFileTypes"); } static NSArray textPasteboardTypes () { return invokeObjcSelfClass!(NSArray, "textPasteboardTypes"); } static NSArray textUnfilteredFileTypes () { return invokeObjcSelfClass!(NSArray, "textUnfilteredFileTypes"); } static NSArray textUnfilteredPasteboardTypes () { return invokeObjcSelfClass!(NSArray, "textUnfilteredPasteboardTypes"); } //mixin ObjcBindClassMethod!(textFileTypes, "textFileTypes"); //mixin ObjcBindClassMethod!(textPasteboardTypes, "textPasteboardTypes"); //mixin ObjcBindClassMethod!(textUnfilteredFileTypes, "textUnfilteredFileTypes"); //mixin ObjcBindClassMethod!(textUnfilteredPasteboardTypes, "textUnfilteredPasteboardTypes"); `; const TNSAttributedStringKitAdditions = ` /*import dstep.appkit.NSFileWrapper; import dstep.appkit.NSTextList; import dstep.appkit.NSTextTable;*/ NSDictionary fontAttributesInRange (NSRange range) { return invokeObjcSelf!(NSDictionary, "fontAttributesInRange:", NSRange)(range); } NSDictionary rulerAttributesInRange (NSRange range) { return invokeObjcSelf!(NSDictionary, "rulerAttributesInRange:", NSRange)(range); } bool containsAttachments () { return invokeObjcSelf!(bool, "containsAttachments"); } NSUInteger lineBreakBeforeIndex (NSUInteger location, NSRange aRange) { return invokeObjcSelf!(NSUInteger, "lineBreakBeforeIndex:withinRange:", NSUInteger, NSRange)(location, aRange); } NSUInteger lineBreakByHyphenatingBeforeIndex (NSUInteger location, NSRange aRange) { return invokeObjcSelf!(NSUInteger, "lineBreakByHyphenatingBeforeIndex:withinRange:", NSUInteger, NSRange)(location, aRange); } NSRange doubleClickAtIndex (NSUInteger location) { return invokeObjcSelf!(NSRange, "doubleClickAtIndex:", NSUInteger)(location); } NSUInteger nextWordFromIndex (NSUInteger location, bool isForward) { return invokeObjcSelf!(NSUInteger, "nextWordFromIndex:forward:", NSUInteger, bool)(location, isForward); } NSURL URLAtIndex (NSUInteger location, NSRangePointer effectiveRange) { return invokeObjcSelf!(NSURL, "URLAtIndex:effectiveRange:", NSUInteger, NSRangePointer)(location, effectiveRange); } static NSArray textTypes () { return invokeObjcSelfClass!(NSArray, "textTypes"); } static NSArray textUnfilteredTypes () { return invokeObjcSelfClass!(NSArray, "textUnfilteredTypes"); } NSRange rangeOfTextBlock (NSTextBlock block, NSUInteger location) { return invokeObjcSelf!(NSRange, "rangeOfTextBlock:atIndex:", NSTextBlock, NSUInteger)(block, location); } NSRange rangeOfTextTable (NSTextTable table, NSUInteger location) { return invokeObjcSelf!(NSRange, "rangeOfTextTable:atIndex:", NSTextTable, NSUInteger)(table, location); } NSRange rangeOfTextList (NSTextList list, NSUInteger location) { return invokeObjcSelf!(NSRange, "rangeOfTextList:atIndex:", NSTextList, NSUInteger)(list, location); } NSInteger itemNumberInTextList (NSTextList list, NSUInteger location) { return invokeObjcSelf!(NSInteger, "itemNumberInTextList:atIndex:", NSTextList, NSUInteger)(list, location); } typeof(this) initWithURL (NSURL url, NSDictionary options, ref NSDictionary dict, ref NSError error) { id __arg2; id __arg3; if (dict) __arg2 = dict.objcObject; if (error) __arg3 = error.objcObject; id result = invokeObjcSelf!(id, "initWithURL:options:documentAttributes:error:", NSURL, NSDictionary, id*, id*)(url, options, &__arg2, &__arg3); if (__arg2) dict = new NSDictionary(__arg2); if (__arg3) error = new NSError(__arg3); return result is this.objcObject ? this : (result !is null ? new typeof(this)(result) : null); } this (NSURL url, NSDictionary options, ref NSDictionary dict, ref NSError error) { super(typeof(this).alloc.initWithURL(url, options, dict, error).objcObject); } typeof(this) initWithData (NSData data, NSDictionary options, ref NSDictionary dict, ref NSError error) { id __arg2; id __arg3; if (dict) __arg2 = dict.objcObject; if (error) __arg3 = error.objcObject; id result = invokeObjcSelf!(id, "initWithData:options:documentAttributes:error:", NSData, NSDictionary, id*, id*)(data, options, &__arg2, &__arg3); if (__arg2) dict = new NSDictionary(__arg2); if (__arg3) error = new NSError(__arg3); return result is this.objcObject ? this : (result !is null ? new typeof(this)(result) : null); } this (NSData data, NSDictionary options, ref NSDictionary dict, ref NSError error) { super(typeof(this).alloc.initWithData(data, options, dict, error).objcObject); } typeof(this) initWithPath (NSString path, ref NSDictionary dict) { id __arg1; if (dict) __arg1 = dict.objcObject; id result = invokeObjcSelf!(id, "initWithPath:documentAttributes:", NSString, id*)(path, &__arg1); if (__arg1) dict = new NSDictionary(__arg1); return result is this.objcObject ? this : (result !is null ? new typeof(this)(result) : null); } this (NSString path, ref NSDictionary dict) { super(typeof(this).alloc.initWithPath(path, dict).objcObject); } typeof(this) initWithURL (NSURL url, ref NSDictionary dict) { id __arg1; if (dict) __arg1 = dict.objcObject; id result = invokeObjcSelf!(id, "initWithURL:documentAttributes:", NSURL, id*)(url, &__arg1); if (__arg1) dict = new NSDictionary(__arg1); return result is this.objcObject ? this : (result !is null ? new typeof(this)(result) : null); } this (NSURL url, ref NSDictionary dict) { super(typeof(this).alloc.initWithURL(url, dict).objcObject); } typeof(this) initWithRTF (NSData data, ref NSDictionary dict) { id __arg1; if (dict) __arg1 = dict.objcObject; id result = invokeObjcSelf!(id, "initWithRTF:documentAttributes:", NSData, id*)(data, &__arg1); if (__arg1) dict = new NSDictionary(__arg1); return result is this.objcObject ? this : (result !is null ? new typeof(this)(result) : null); } this (NSData data, ref NSDictionary dict) { super(typeof(this).alloc.initWithRTF(data, dict).objcObject); } typeof(this) initWithRTFD (NSData data, ref NSDictionary dict) { id __arg1; if (dict) __arg1 = dict.objcObject; id result = invokeObjcSelf!(id, "initWithRTFD:documentAttributes:", NSData, id*)(data, &__arg1); if (__arg1) dict = new NSDictionary(__arg1); return result is this.objcObject ? this : (result !is null ? new typeof(this)(result) : null); } this (NSData data, ref NSDictionary dict) { super(typeof(this).alloc.initWithRTFD(data, dict).objcObject); } typeof(this) initWithHTML (NSData data, ref NSDictionary dict) { id __arg1; if (dict) __arg1 = dict.objcObject; id result = invokeObjcSelf!(id, "initWithHTML:documentAttributes:", NSData, id*)(data, &__arg1); if (__arg1) dict = new NSDictionary(__arg1); return result is this.objcObject ? this : (result !is null ? new typeof(this)(result) : null); } this (NSData data, ref NSDictionary dict) { super(typeof(this).alloc.initWithHTML(data, dict).objcObject); } typeof(this) initWithHTML (NSData data, NSURL base, ref NSDictionary dict) { id __arg2; if (dict) __arg2 = dict.objcObject; id result = invokeObjcSelf!(id, "initWithHTML:baseURL:documentAttributes:", NSData, NSURL, id*)(data, base, &__arg2); if (__arg2) dict = new NSDictionary(__arg2); return result is this.objcObject ? this : (result !is null ? new typeof(this)(result) : null); } this (NSData data, NSURL base, ref NSDictionary dict) { super(typeof(this).alloc.initWithHTML(data, base, dict).objcObject); } typeof(this) initWithDocFormat (NSData data, ref NSDictionary dict) { id __arg1; if (dict) __arg1 = dict.objcObject; id result = invokeObjcSelf!(id, "initWithDocFormat:documentAttributes:", NSData, id*)(data, &__arg1); if (__arg1) dict = new NSDictionary(__arg1); return result is this.objcObject ? this : (result !is null ? new typeof(this)(result) : null); } this (NSData data, ref NSDictionary dict) { super(typeof(this).alloc.initWithDocFormat(data, dict).objcObject); } typeof(this) initWithHTML (NSData data, NSDictionary options, ref NSDictionary dict) { id __arg2; if (dict) __arg2 = dict.objcObject; id result = invokeObjcSelf!(id, "initWithHTML:options:documentAttributes:", NSData, NSDictionary, id*)(data, options, &__arg2); if (__arg2) dict = new NSDictionary(__arg2); return result is this.objcObject ? this : (result !is null ? new typeof(this)(result) : null); } this (NSData data, NSDictionary options, ref NSDictionary dict) { super(typeof(this).alloc.initWithHTML(data, options, dict).objcObject); } typeof(this) initWithRTFDFileWrapper (NSFileWrapper wrapper, ref NSDictionary dict) { id __arg1; if (dict) __arg1 = dict.objcObject; id result = invokeObjcSelf!(id, "initWithRTFDFileWrapper:documentAttributes:", NSFileWrapper, id*)(wrapper, &__arg1); if (__arg1) dict = new NSDictionary(__arg1); return result is this.objcObject ? this : (result !is null ? new typeof(this)(result) : null); } this (NSFileWrapper wrapper, ref NSDictionary dict) { super(typeof(this).alloc.initWithRTFDFileWrapper(wrapper, dict).objcObject); } NSData dataFromRange (NSRange range, NSDictionary dict, ref NSError error) { id __arg2; if (error) __arg2 = error.objcObject; NSData result = invokeObjcSelf!(NSData, "dataFromRange:documentAttributes:error:", NSRange, NSDictionary, id*)(range, dict, &__arg2); if (__arg2) error = new NSError(__arg2); return result; } NSFileWrapper fileWrapperFromRange (NSRange range, NSDictionary dict, ref NSError error) { id __arg2; if (error) __arg2 = error.objcObject; NSFileWrapper result = invokeObjcSelf!(NSFileWrapper, "fileWrapperFromRange:documentAttributes:error:", NSRange, NSDictionary, id*)(range, dict, &__arg2); if (__arg2) error = new NSError(__arg2); return result; } NSData RTFFromRange (NSRange range, NSDictionary dict) { return invokeObjcSelf!(NSData, "RTFFromRange:documentAttributes:", NSRange, NSDictionary)(range, dict); } NSData RTFDFromRange (NSRange range, NSDictionary dict) { return invokeObjcSelf!(NSData, "RTFDFromRange:documentAttributes:", NSRange, NSDictionary)(range, dict); } NSFileWrapper RTFDFileWrapperFromRange (NSRange range, NSDictionary dict) { return invokeObjcSelf!(NSFileWrapper, "RTFDFileWrapperFromRange:documentAttributes:", NSRange, NSDictionary)(range, dict); } NSData docFormatFromRange (NSRange range, NSDictionary dict) { return invokeObjcSelf!(NSData, "docFormatFromRange:documentAttributes:", NSRange, NSDictionary)(range, dict); } //mixin ObjcBindMethod!(fontAttributesInRange, "fontAttributesInRange:"); //mixin ObjcBindMethod!(rulerAttributesInRange, "rulerAttributesInRange:"); //mixin ObjcBindMethod!(containsAttachments, "containsAttachments"); //mixin ObjcBindMethod!(lineBreakBeforeIndex, "lineBreakBeforeIndex:withinRange:"); //mixin ObjcBindMethod!(lineBreakByHyphenatingBeforeIndex, "lineBreakByHyphenatingBeforeIndex:withinRange:"); //mixin ObjcBindMethod!(doubleClickAtIndex, "doubleClickAtIndex:"); //mixin ObjcBindMethod!(nextWordFromIndex, "nextWordFromIndex:forward:"); //mixin ObjcBindMethod!(URLAtIndex, "URLAtIndex:effectiveRange:"); //mixin ObjcBindClassMethod!(textTypes, "textTypes"); //mixin ObjcBindClassMethod!(textUnfilteredTypes, "textUnfilteredTypes"); //mixin ObjcBindMethod!(rangeOfTextBlock, "rangeOfTextBlock:atIndex:"); //mixin ObjcBindMethod!(rangeOfTextTable, "rangeOfTextTable:atIndex:"); //mixin ObjcBindMethod!(rangeOfTextList, "rangeOfTextList:atIndex:"); //mixin ObjcBindMethod!(itemNumberInTextList, "itemNumberInTextList:atIndex:"); /*//mixin ObjcBindMethod!(initWithURL, "initWithURL:options:documentAttributes:error:"); //mixin ObjcBindMethod!(initWithData, "initWithData:options:documentAttributes:error:"); //mixin ObjcBindMethod!(initWithPath, "initWithPath:documentAttributes:"); //mixin ObjcBindMethod!(initWithURL, "initWithURL:documentAttributes:"); //mixin ObjcBindMethod!(initWithRTF, "initWithRTF:documentAttributes:"); //mixin ObjcBindMethod!(initWithRTFD, "initWithRTFD:documentAttributes:"); //mixin ObjcBindMethod!(initWithHTML, "initWithHTML:documentAttributes:"); //mixin ObjcBindMethod!(initWithHTML, "initWithHTML:baseURL:documentAttributes:"); //mixin ObjcBindMethod!(initWithDocFormat, "initWithDocFormat:documentAttributes:"); //mixin ObjcBindMethod!(initWithHTML, "initWithHTML:options:documentAttributes:"); //mixin ObjcBindMethod!(initWithRTFDFileWrapper, "initWithRTFDFileWrapper:documentAttributes:");*/ /*//mixin ObjcBindMethod!(dataFromRange, "dataFromRange:documentAttributes:error:"); //mixin ObjcBindMethod!(fileWrapperFromRange, "fileWrapperFromRange:documentAttributes:error:");*/ //mixin ObjcBindMethod!(RTFFromRange, "RTFFromRange:documentAttributes:"); //mixin ObjcBindMethod!(RTFDFromRange, "RTFDFromRange:documentAttributes:"); //mixin ObjcBindMethod!(RTFDFileWrapperFromRange, "RTFDFileWrapperFromRange:documentAttributes:"); //mixin ObjcBindMethod!(docFormatFromRange, "docFormatFromRange:documentAttributes:"); `; const TNSExtendedMutableAttributedString = ` /*NSMutableString mutableString () { return invokeObjcSelf!(NSMutableString, "mutableString"); }*/ void addAttribute (NSString name, Object value, NSRange range) { return invokeObjcSelf!(void, "addAttribute:value:range:", NSString, Object, NSRange)(name, value, range); } void addAttributes (NSDictionary attrs, NSRange range) { return invokeObjcSelf!(void, "addAttributes:range:", NSDictionary, NSRange)(attrs, range); } void removeAttribute (NSString name, NSRange range) { return invokeObjcSelf!(void, "removeAttribute:range:", NSString, NSRange)(name, range); } void replaceCharactersInRange (NSRange range, NSAttributedString attrString) { return invokeObjcSelf!(void, "replaceCharactersInRange:withAttributedString:", NSRange, NSAttributedString)(range, attrString); } void insertAttributedString (NSAttributedString attrString, NSUInteger loc) { return invokeObjcSelf!(void, "insertAttributedString:atIndex:", NSAttributedString, NSUInteger)(attrString, loc); } void appendAttributedString (NSAttributedString attrString) { return invokeObjcSelf!(void, "appendAttributedString:", NSAttributedString)(attrString); } void deleteCharactersInRange (NSRange range) { return invokeObjcSelf!(void, "deleteCharactersInRange:", NSRange)(range); } void setAttributedString (NSAttributedString attrString) { return invokeObjcSelf!(void, "setAttributedString:", NSAttributedString)(attrString); } /*void beginEditing () { return invokeObjcSelf!(void, "beginEditing"); } void endEditing () { return invokeObjcSelf!(void, "endEditing"); }*/ ////mixin ObjcBindMethod!(mutableString, "mutableString"); //mixin ObjcBindMethod!(addAttribute, "addAttribute:value:range:"); //mixin ObjcBindMethod!(addAttributes, "addAttributes:range:"); //mixin ObjcBindMethod!(removeAttribute, "removeAttribute:range:"); //mixin ObjcBindMethod!(replaceCharactersInRange, "replaceCharactersInRange:withAttributedString:"); //mixin ObjcBindMethod!(insertAttributedString, "insertAttributedString:atIndex:"); //mixin ObjcBindMethod!(appendAttributedString, "appendAttributedString:"); //mixin ObjcBindMethod!(deleteCharactersInRange, "deleteCharactersInRange:"); //mixin ObjcBindMethod!(setAttributedString, "setAttributedString:"); /*//mixin ObjcBindMethod!(beginEditing, "beginEditing"); //mixin ObjcBindMethod!(endEditing, "endEditing");*/ `;