Mercurial > projects > dwt-mac
diff dwt/internal/cocoa/NSTextStorage.d @ 0:380af2bdd8e5
Upload of whole dwt tree
author | Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com> |
---|---|
date | Sat, 09 Aug 2008 17:00:02 +0200 |
parents | |
children | 8b48be5454ce |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/cocoa/NSTextStorage.d Sat Aug 09 17:00:02 2008 +0200 @@ -0,0 +1,175 @@ +/******************************************************************************* + * Copyright (c) 2007 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 + * + * Port to the D Programming language: + * Jacob Carlborg <jacob.carlborg@gmail.com> + *******************************************************************************/ +module dwt.internal.cocoa.NSTextStorage; + +import dwt.internal.cocoa.id; +import dwt.internal.cocoa.NSArray; +import dwt.internal.cocoa.NSColor; +import dwt.internal.cocoa.NSFont; +import dwt.internal.cocoa.NSInteger; +import dwt.internal.cocoa.NSLayoutManager; +import dwt.internal.cocoa.NSMutableAttributedString; +import dwt.internal.cocoa.NSRange; +import dwt.internal.cocoa.OS; +import objc = dwt.internal.objc.runtime; + +public class NSTextStorage : NSMutableAttributedString +{ + + public this () + { + super(); + } + + public this (objc.id id) + { + super(id); + } + + public void addLayoutManager (NSLayoutManager obj) + { + OS.objc_msgSend(this.id, OS.sel_addLayoutManager_1, obj !is null ? obj.id : null); + } + + public NSArray attributeRuns () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_attributeRuns); + return result !is null ? new NSArray(result) : null; + } + + public NSInteger changeInLength () + { + return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_changeInLength); + } + + public NSArray characters () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_characters); + return result !is null ? new NSArray(result) : 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 edited (NSUInteger editedMask, NSRange range, NSInteger delta) + { + OS.objc_msgSend(this.id, OS.sel_edited_1range_1changeInLength_1, editedMask, range, delta); + } + + public NSUInteger editedMask () + { + return cast(NSUInteger) OS.objc_msgSend(this.id, OS.sel_editedMask); + } + + public NSRange editedRange () + { + NSRange result; + OS.objc_msgSend_stret(result, this.id, OS.sel_editedRange); + return result; + } + + public void ensureAttributesAreFixedInRange (NSRange range) + { + OS.objc_msgSend(this.id, OS.sel_ensureAttributesAreFixedInRange_1, range); + } + + public bool fixesAttributesLazily () + { + return OS.objc_msgSend(this.id, OS.sel_fixesAttributesLazily) !is null; + } + + public NSFont font () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_font); + return result !is null ? new NSFont(result) : null; + } + + public NSColor foregroundColor () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_foregroundColor); + return result !is null ? new NSColor(result) : null; + } + + public void invalidateAttributesInRange (NSRange range) + { + OS.objc_msgSend(this.id, OS.sel_invalidateAttributesInRange_1, range); + } + + public NSArray layoutManagers () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_layoutManagers); + return result !is null ? new NSArray(result) : null; + } + + public NSArray paragraphs () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_paragraphs); + return result !is null ? new NSArray(result) : null; + } + + public void processEditing () + { + OS.objc_msgSend(this.id, OS.sel_processEditing); + } + + public void removeLayoutManager (NSLayoutManager obj) + { + OS.objc_msgSend(this.id, OS.sel_removeLayoutManager_1, obj !is null ? obj.id : null); + } + + public void setAttributeRuns (NSArray attributeRuns) + { + OS.objc_msgSend(this.id, OS.sel_setAttributeRuns_1, attributeRuns !is null ? attributeRuns.id : null); + } + + public void setCharacters (NSArray characters) + { + OS.objc_msgSend(this.id, OS.sel_setCharacters_1, characters !is null ? characters.id : null); + } + + public void setDelegate (id delegatee) + { + OS.objc_msgSend(this.id, OS.sel_setDelegate_1, delegatee !is null ? delegatee.id : null); + } + + public void setFont (NSFont font) + { + OS.objc_msgSend(this.id, OS.sel_setFont_1, font !is null ? font.id : null); + } + + public void setForegroundColor (NSColor color) + { + OS.objc_msgSend(this.id, OS.sel_setForegroundColor_1, color !is null ? color.id : null); + } + + public void setParagraphs (NSArray paragraphs) + { + OS.objc_msgSend(this.id, OS.sel_setParagraphs_1, paragraphs !is null ? paragraphs.id : null); + } + + public void setWords (NSArray words) + { + OS.objc_msgSend(this.id, OS.sel_setWords_1, words !is null ? words.id : null); + } + + public NSArray words () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_words); + return result !is null ? new NSArray(result) : null; + } + +}