Mercurial > projects > dstep
view dstep/appkit/NSTextStorage.d @ 16:19885b43130e
Huge update, the bridge actually works now
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Sun, 03 Jan 2010 22:06:11 +0100 |
parents | |
children | b9de51448c6b |
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.NSTextStorage; import dstep.appkit.NSAttributedString; import dstep.appkit.NSColor; import dstep.appkit.NSFont; import dstep.appkit.NSLayoutManager; import dstep.appkit.NSTextStorageScripting; import dstep.foundation.NSArray; import dstep.foundation.NSAttributedString; import dstep.foundation.NSObjCRuntime; import dstep.foundation.NSObject; import dstep.foundation.NSRange; import dstep.foundation.NSString; import dstep.objc.bridge.Bridge; import dstep.objc.objc; import bindings = dstep.appkit.NSTextStorage_bindings; private { NSString NSTextStorageWillProcessEditingNotification_; NSString NSTextStorageDidProcessEditingNotification_; } NSString NSTextStorageWillProcessEditingNotification () { if (NSTextStorageWillProcessEditingNotification_) return NSTextStorageWillProcessEditingNotification_; return NSTextStorageWillProcessEditingNotification_ = new NSString(bindings.NSTextStorageWillProcessEditingNotification); } NSString NSTextStorageDidProcessEditingNotification () { if (NSTextStorageDidProcessEditingNotification_) return NSTextStorageDidProcessEditingNotification_; return NSTextStorageDidProcessEditingNotification_ = new NSString(bindings.NSTextStorageDidProcessEditingNotification); } enum { NSTextStorageEditedAttributes = 1, NSTextStorageEditedCharacters = 2 } const TNSTextStorageDelegate = ` void textStorageWillProcessEditing (NSNotification notification) { return invokeObjcSelf!(void, "textStorageWillProcessEditing:", NSNotification)(notification); } void textStorageDidProcessEditing (NSNotification notification) { return invokeObjcSelf!(void, "textStorageDidProcessEditing:", NSNotification)(notification); } //mixin ObjcBindMethod!(textStorageWillProcessEditing, "textStorageWillProcessEditing:"); //mixin ObjcBindMethod!(textStorageDidProcessEditing, "textStorageDidProcessEditing:"); `; class NSTextStorage : NSMutableAttributedString { mixin (ObjcWrap); void addLayoutManager (NSLayoutManager obj) { return invokeObjcSelf!(void, "addLayoutManager:", NSLayoutManager)(obj); } void removeLayoutManager (NSLayoutManager obj) { return invokeObjcSelf!(void, "removeLayoutManager:", NSLayoutManager)(obj); } NSArray layoutManagers () { return invokeObjcSelf!(NSArray, "layoutManagers"); } void edited (NSUInteger editedMask, NSRange range, NSInteger delta) { return invokeObjcSelf!(void, "edited:range:changeInLength:", NSUInteger, NSRange, NSInteger)(editedMask, range, delta); } void processEditing () { return invokeObjcSelf!(void, "processEditing"); } void invalidateAttributesInRange (NSRange range) { return invokeObjcSelf!(void, "invalidateAttributesInRange:", NSRange)(range); } void ensureAttributesAreFixedInRange (NSRange range) { return invokeObjcSelf!(void, "ensureAttributesAreFixedInRange:", NSRange)(range); } bool fixesAttributesLazily () { return invokeObjcSelf!(bool, "fixesAttributesLazily"); } NSUInteger editedMask () { return invokeObjcSelf!(NSUInteger, "editedMask"); } NSRange editedRange () { return invokeObjcSelf!(NSRange, "editedRange"); } NSInteger changeInLength () { return invokeObjcSelf!(NSInteger, "changeInLength"); } void setDelegate (Object delegate_) { return invokeObjcSelf!(void, "setDelegate:", Object)(delegate_); } Object delegate_ () { return invokeObjcSelf!(Object, "delegate"); } // Scripting NSArray attributeRuns () { return invokeObjcSelf!(NSArray, "attributeRuns"); } void setAttributeRuns (NSArray attributeRuns) { return invokeObjcSelf!(void, "setAttributeRuns:", NSArray)(attributeRuns); } NSArray paragraphs () { return invokeObjcSelf!(NSArray, "paragraphs"); } void setParagraphs (NSArray paragraphs) { return invokeObjcSelf!(void, "setParagraphs:", NSArray)(paragraphs); } NSArray words () { return invokeObjcSelf!(NSArray, "words"); } void setWords (NSArray words) { return invokeObjcSelf!(void, "setWords:", NSArray)(words); } NSArray characters () { return invokeObjcSelf!(NSArray, "characters"); } void setCharacters (NSArray characters) { return invokeObjcSelf!(void, "setCharacters:", NSArray)(characters); } NSFont font () { return invokeObjcSelf!(NSFont, "font"); } void setFont (NSFont font) { return invokeObjcSelf!(void, "setFont:", NSFont)(font); } NSColor foregroundColor () { return invokeObjcSelf!(NSColor, "foregroundColor"); } void setForegroundColor (NSColor color) { return invokeObjcSelf!(void, "setForegroundColor:", NSColor)(color); } }