diff dstep/appkit/NSParagraphStyle.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 diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dstep/appkit/NSParagraphStyle.d	Sun Jan 03 22:06:11 2010 +0100
@@ -0,0 +1,375 @@
+/**
+ * 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.NSParagraphStyle;
+
+import dstep.appkit.NSText;
+import dstep.applicationservices.coregraphics.CGBase;
+import dstep.foundation.NSArray;
+import dstep.foundation.NSCoder;
+import dstep.foundation.NSDictionary;
+import dstep.foundation.NSObjCRuntime;
+import dstep.foundation.NSObject;
+import dstep.foundation.NSString;
+import dstep.foundation.NSZone;
+import dstep.objc.bridge.Bridge;
+import dstep.objc.objc;
+
+import bindings = dstep.appkit.NSParagraphStyle_bindings;
+
+alias NSUInteger NSTextTabType;
+alias NSUInteger NSLineBreakMode;
+
+private
+{
+	NSString NSTabColumnTerminatorsAttributeName_;
+}
+
+NSString NSTabColumnTerminatorsAttributeName ()
+{
+	if (NSTabColumnTerminatorsAttributeName_)
+		return NSTabColumnTerminatorsAttributeName_;
+
+	return NSTabColumnTerminatorsAttributeName_ = new NSString(bindings.NSTabColumnTerminatorsAttributeName);
+}
+
+enum
+{
+	NSLeftTabStopType = 0,
+	NSRightTabStopType,
+	NSCenterTabStopType,
+	NSDecimalTabStopType
+}
+
+enum
+{
+	NSLineBreakByWordWrapping = 0,
+	NSLineBreakByCharWrapping,
+	NSLineBreakByClipping,
+	NSLineBreakByTruncatingHead,
+	NSLineBreakByTruncatingTail,
+	NSLineBreakByTruncatingMiddle
+}
+
+class NSTextTab : NSObject, INSCopying, INSCoding
+{
+	mixin (ObjcWrap);
+	
+	this (NSCoder aDecoder)
+	{
+		super(typeof(this).alloc.initWithCoder(aDecoder).objcObject);
+	}
+	
+	void encodeWithCoder (NSCoder aCoder)
+	{
+		return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder);
+	}
+	
+	typeof(this) initWithCoder (NSCoder aDecoder)
+	{
+		return invokeObjcSelf!(typeof(this), "initWithCoder:", NSCoder)(aDecoder);
+	}
+	
+	typeof(this) copyWithZone (NSZone* zone)
+	{
+		return invokeObjcSelf!(typeof(this), "copyWithZone:", NSZone*)(zone);
+	}
+
+	NSTextTab initWithTextAlignment (uint alignment, CGFloat loc, NSDictionary options)
+	{
+		id result = invokeObjcSelf!(id, "initWithTextAlignment:location:options:", uint, CGFloat, NSDictionary)(alignment, loc, options);
+		return result is this.objcObject ? this : (result !is null ? new NSTextTab(result) : null);
+	}
+
+	this (uint alignment, CGFloat loc, NSDictionary options)
+	{
+		super(NSTextTab.alloc.initWithTextAlignment(alignment, loc, options).objcObject);
+	}
+
+	uint alignment ()
+	{
+		return invokeObjcSelf!(uint, "alignment");
+	}
+
+	NSDictionary options ()
+	{
+		return invokeObjcSelf!(NSDictionary, "options");
+	}
+
+	NSTextTab initWithType (uint type, CGFloat loc)
+	{
+		id result = invokeObjcSelf!(id, "initWithType:location:", uint, CGFloat)(type, loc);
+		return result is this.objcObject ? this : (result !is null ? new NSTextTab(result) : null);
+	}
+
+	this (uint type, CGFloat loc)
+	{
+		super(NSTextTab.alloc.initWithType(type, loc).objcObject);
+	}
+
+	CGFloat location ()
+	{
+		return invokeObjcSelf!(CGFloat, "location");
+	}
+
+	uint tabStopType ()
+	{
+		return invokeObjcSelf!(uint, "tabStopType");
+	}
+
+}
+
+class NSMutableParagraphStyle : NSParagraphStyle
+{
+	mixin (ObjcWrap);
+
+	void setLineSpacing (CGFloat aFloat)
+	{
+		return invokeObjcSelf!(void, "setLineSpacing:", CGFloat)(aFloat);
+	}
+
+	void setParagraphSpacing (CGFloat aFloat)
+	{
+		return invokeObjcSelf!(void, "setParagraphSpacing:", CGFloat)(aFloat);
+	}
+
+	void setAlignment (uint alignment)
+	{
+		return invokeObjcSelf!(void, "setAlignment:", uint)(alignment);
+	}
+
+	void setFirstLineHeadIndent (CGFloat aFloat)
+	{
+		return invokeObjcSelf!(void, "setFirstLineHeadIndent:", CGFloat)(aFloat);
+	}
+
+	void setHeadIndent (CGFloat aFloat)
+	{
+		return invokeObjcSelf!(void, "setHeadIndent:", CGFloat)(aFloat);
+	}
+
+	void setTailIndent (CGFloat aFloat)
+	{
+		return invokeObjcSelf!(void, "setTailIndent:", CGFloat)(aFloat);
+	}
+
+	void setLineBreakMode (uint mode)
+	{
+		return invokeObjcSelf!(void, "setLineBreakMode:", uint)(mode);
+	}
+
+	void setMinimumLineHeight (CGFloat aFloat)
+	{
+		return invokeObjcSelf!(void, "setMinimumLineHeight:", CGFloat)(aFloat);
+	}
+
+	void setMaximumLineHeight (CGFloat aFloat)
+	{
+		return invokeObjcSelf!(void, "setMaximumLineHeight:", CGFloat)(aFloat);
+	}
+
+	void addTabStop (NSTextTab anObject)
+	{
+		return invokeObjcSelf!(void, "addTabStop:", NSTextTab)(anObject);
+	}
+
+	void removeTabStop (NSTextTab anObject)
+	{
+		return invokeObjcSelf!(void, "removeTabStop:", NSTextTab)(anObject);
+	}
+
+	void setTabStops (NSArray array)
+	{
+		return invokeObjcSelf!(void, "setTabStops:", NSArray)(array);
+	}
+
+	void setParagraphStyle (NSParagraphStyle obj)
+	{
+		return invokeObjcSelf!(void, "setParagraphStyle:", NSParagraphStyle)(obj);
+	}
+
+	void setBaseWritingDirection (int writingDirection)
+	{
+		return invokeObjcSelf!(void, "setBaseWritingDirection:", int)(writingDirection);
+	}
+
+	void setLineHeightMultiple (CGFloat aFloat)
+	{
+		return invokeObjcSelf!(void, "setLineHeightMultiple:", CGFloat)(aFloat);
+	}
+
+	void setParagraphSpacingBefore (CGFloat aFloat)
+	{
+		return invokeObjcSelf!(void, "setParagraphSpacingBefore:", CGFloat)(aFloat);
+	}
+
+	void setDefaultTabInterval (CGFloat aFloat)
+	{
+		return invokeObjcSelf!(void, "setDefaultTabInterval:", CGFloat)(aFloat);
+	}
+
+	void setTextBlocks (NSArray array)
+	{
+		return invokeObjcSelf!(void, "setTextBlocks:", NSArray)(array);
+	}
+
+	void setTextLists (NSArray array)
+	{
+		return invokeObjcSelf!(void, "setTextLists:", NSArray)(array);
+	}
+
+	void setHyphenationFactor (float aFactor)
+	{
+		return invokeObjcSelf!(void, "setHyphenationFactor:", float)(aFactor);
+	}
+
+	void setTighteningFactorForTruncation (float aFactor)
+	{
+		return invokeObjcSelf!(void, "setTighteningFactorForTruncation:", float)(aFactor);
+	}
+
+	void setHeaderLevel (NSInteger level)
+	{
+		return invokeObjcSelf!(void, "setHeaderLevel:", NSInteger)(level);
+	}
+}
+
+class NSParagraphStyle : NSObject, INSCopying, INSMutableCopying, INSCoding
+{
+	mixin (ObjcWrap);
+	
+	NSParagraphStyle mutableCopyWithZone (NSZone* aZone)
+	{
+		return invokeObjcSelf!(NSParagraphStyle, "mutableCopyWithZone:", NSZone*)(aZone);
+	}
+	
+	this (NSCoder aDecoder)
+	{
+		super(typeof(this).alloc.initWithCoder(aDecoder).objcObject);
+	}
+	
+	void encodeWithCoder (NSCoder aCoder)
+	{
+		return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder);
+	}
+	
+	typeof(this) initWithCoder (NSCoder aDecoder)
+	{
+		return invokeObjcSelf!(typeof(this), "initWithCoder:", NSCoder)(aDecoder);
+	}
+	
+	typeof(this) copyWithZone (NSZone* zone)
+	{
+		return invokeObjcSelf!(typeof(this), "copyWithZone:", NSZone*)(zone);
+	}
+
+	static NSParagraphStyle defaultParagraphStyle ()
+	{
+		return invokeObjcSelfClass!(NSParagraphStyle, "defaultParagraphStyle");
+	}
+
+	static int defaultWritingDirectionForLanguage (NSString languageName)
+	{
+		return invokeObjcSelfClass!(int, "defaultWritingDirectionForLanguage:", NSString)(languageName);
+	}
+
+	CGFloat lineSpacing ()
+	{
+		return invokeObjcSelf!(CGFloat, "lineSpacing");
+	}
+
+	CGFloat paragraphSpacing ()
+	{
+		return invokeObjcSelf!(CGFloat, "paragraphSpacing");
+	}
+
+	uint alignment ()
+	{
+		return invokeObjcSelf!(uint, "alignment");
+	}
+
+	CGFloat headIndent ()
+	{
+		return invokeObjcSelf!(CGFloat, "headIndent");
+	}
+
+	CGFloat tailIndent ()
+	{
+		return invokeObjcSelf!(CGFloat, "tailIndent");
+	}
+
+	CGFloat firstLineHeadIndent ()
+	{
+		return invokeObjcSelf!(CGFloat, "firstLineHeadIndent");
+	}
+
+	NSArray tabStops ()
+	{
+		return invokeObjcSelf!(NSArray, "tabStops");
+	}
+
+	CGFloat minimumLineHeight ()
+	{
+		return invokeObjcSelf!(CGFloat, "minimumLineHeight");
+	}
+
+	CGFloat maximumLineHeight ()
+	{
+		return invokeObjcSelf!(CGFloat, "maximumLineHeight");
+	}
+
+	uint lineBreakMode ()
+	{
+		return invokeObjcSelf!(uint, "lineBreakMode");
+	}
+
+	int baseWritingDirection ()
+	{
+		return invokeObjcSelf!(int, "baseWritingDirection");
+	}
+
+	CGFloat lineHeightMultiple ()
+	{
+		return invokeObjcSelf!(CGFloat, "lineHeightMultiple");
+	}
+
+	CGFloat paragraphSpacingBefore ()
+	{
+		return invokeObjcSelf!(CGFloat, "paragraphSpacingBefore");
+	}
+
+	CGFloat defaultTabInterval ()
+	{
+		return invokeObjcSelf!(CGFloat, "defaultTabInterval");
+	}
+
+	NSArray textBlocks ()
+	{
+		return invokeObjcSelf!(NSArray, "textBlocks");
+	}
+
+	NSArray textLists ()
+	{
+		return invokeObjcSelf!(NSArray, "textLists");
+	}
+
+	float hyphenationFactor ()
+	{
+		return invokeObjcSelf!(float, "hyphenationFactor");
+	}
+
+	float tighteningFactorForTruncation ()
+	{
+		return invokeObjcSelf!(float, "tighteningFactorForTruncation");
+	}
+
+	NSInteger headerLevel ()
+	{
+		return invokeObjcSelf!(NSInteger, "headerLevel");
+	}
+
+}
+