Mercurial > projects > dwt-mac
view dwt/internal/cocoa/NSGlyphInfo.d @ 13:f565d3a95c0a
Ported dwt.internal
author | Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com> |
---|---|
date | Fri, 22 Aug 2008 16:46:34 +0200 |
parents | 8b48be5454ce |
children |
line wrap: on
line source
/******************************************************************************* * 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.NSGlyphInfo; import dwt.internal.cocoa.NSFont; import dwt.internal.cocoa.NSInteger; import dwt.internal.cocoa.NSObject; import dwt.internal.cocoa.NSString; import dwt.internal.cocoa.OS; import objc = dwt.internal.objc.runtime; enum NSCharacterCollection { NSIdentityMappingCharacterCollection = 0, NSAdobeCNS1CharacterCollection = 1, NSAdobeGB1CharacterCollection = 2, NSAdobeJapan1CharacterCollection = 3, NSAdobeJapan2CharacterCollection = 4, NSAdobeKorea1CharacterCollection = 5, } public class NSGlyphInfo : NSObject { public this () { super(); } public this (objc.id id) { super(id); } public NSCharacterCollection characterCollection () { return cast(NSCharacterCollection) OS.objc_msgSend(this.id_, OS.sel_characterCollection); } public NSUInteger characterIdentifier () { return cast(NSUInteger) OS.objc_msgSend(this.id_, OS.sel_characterIdentifier); } public static NSGlyphInfo glyphInfoWithCharacterIdentifier (NSUInteger cid, NSCharacterCollection characterCollection, NSString theString) { objc.id result = OS.objc_msgSend(OS.class_NSGlyphInfo, OS.sel_glyphInfoWithCharacterIdentifier_1collection_1baseString_1, cid, characterCollection, theString !is null ? theString.id_ : null); return result !is null ? new NSGlyphInfo(result) : null; } public static NSGlyphInfo glyphInfoWithGlyph (NSGlyph glyph, NSFont font, NSString theString) { objc.id result = OS.objc_msgSend(OS.class_NSGlyphInfo, OS.sel_glyphInfoWithGlyph_1forFont_1baseString_1, glyph, font !is null ? font.id_ : null, theString !is null ? theString.id_ : null); return result !is null ? new NSGlyphInfo(result) : null; } public static NSGlyphInfo glyphInfoWithGlyphName (NSString glyphName, NSFont font, NSString theString) { objc.id result = OS.objc_msgSend(OS.class_NSGlyphInfo, OS.sel_glyphInfoWithGlyphName_1forFont_1baseString_1, glyphName !is null ? glyphName.id_ : null, font !is null ? font.id_ : null, theString !is null ? theString.id_ : null); return result !is null ? new NSGlyphInfo(result) : null; } public NSString glyphName () { objc.id result = OS.objc_msgSend(this.id_, OS.sel_glyphName); return result !is null ? new NSString(result) : null; } }