diff dstep/appkit/NSBezierPath.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/NSBezierPath.d	Sun Jan 03 22:06:11 2010 +0100
@@ -0,0 +1,440 @@
+/**
+ * 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.NSBezierPath;
+
+import dstep.appkit.NSAffineTransform;
+import dstep.appkit.NSFont;
+import dstep.applicationservices.coregraphics.CGBase;
+import dstep.foundation.NSCoder;
+import dstep.foundation.NSGeometry;
+import dstep.foundation.NSObjCRuntime;
+import dstep.foundation.NSObject;
+import dstep.foundation.NSZone;
+import dstep.objc.bridge.Bridge;
+import dstep.objc.objc;
+
+alias NSUInteger NSLineCapStyle;
+alias NSUInteger NSLineJoinStyle;
+alias NSUInteger NSWindingRule;
+alias NSUInteger NSBezierPathElement;
+
+enum
+{
+	NSButtLineCapStyle = 0,
+	NSRoundLineCapStyle = 1,
+	NSSquareLineCapStyle = 2
+}
+
+enum
+{
+	NSMiterLineJoinStyle = 0,
+	NSRoundLineJoinStyle = 1,
+	NSBevelLineJoinStyle = 2
+}
+
+enum
+{
+	NSNonZeroWindingRule = 0,
+	NSEvenOddWindingRule = 1
+}
+
+enum
+{
+	NSMoveToBezierPathElement,
+	NSLineToBezierPathElement,
+	NSCurveToBezierPathElement,
+	NSClosePathBezierPathElement
+}
+
+class NSBezierPath : 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);
+	}
+
+	static NSBezierPath bezierPath ()
+	{
+		return invokeObjcSelfClass!(NSBezierPath, "bezierPath");
+	}
+
+	static NSBezierPath bezierPathWithRect (NSRect rect)
+	{
+		return invokeObjcSelfClass!(NSBezierPath, "bezierPathWithRect:", NSRect)(rect);
+	}
+
+	static NSBezierPath bezierPathWithOvalInRect (NSRect rect)
+	{
+		return invokeObjcSelfClass!(NSBezierPath, "bezierPathWithOvalInRect:", NSRect)(rect);
+	}
+
+	static NSBezierPath bezierPathWithRoundedRect (NSRect rect, CGFloat xRadius, CGFloat yRadius)
+	{
+		return invokeObjcSelfClass!(NSBezierPath, "bezierPathWithRoundedRect:xRadius:yRadius:", NSRect, CGFloat, CGFloat)(rect, xRadius, yRadius);
+	}
+
+	static void fillRect (NSRect rect)
+	{
+		return invokeObjcSelfClass!(void, "fillRect:", NSRect)(rect);
+	}
+
+	static void strokeRect (NSRect rect)
+	{
+		return invokeObjcSelfClass!(void, "strokeRect:", NSRect)(rect);
+	}
+
+	static void clipRect (NSRect rect)
+	{
+		return invokeObjcSelfClass!(void, "clipRect:", NSRect)(rect);
+	}
+
+	static void strokeLineFromPoint (NSPoint point1, NSPoint point2)
+	{
+		return invokeObjcSelfClass!(void, "strokeLineFromPoint:toPoint:", NSPoint, NSPoint)(point1, point2);
+	}
+
+	static void drawPackedGlyphs (char* packedGlyphs, NSPoint point)
+	{
+		return invokeObjcSelfClass!(void, "drawPackedGlyphs:atPoint:", char*, NSPoint)(packedGlyphs, point);
+	}
+
+	static void setDefaultMiterLimit (CGFloat limit)
+	{
+		return invokeObjcSelfClass!(void, "setDefaultMiterLimit:", CGFloat)(limit);
+	}
+
+	static CGFloat defaultMiterLimit ()
+	{
+		return invokeObjcSelfClass!(CGFloat, "defaultMiterLimit");
+	}
+
+	static void setDefaultFlatness (CGFloat flatness)
+	{
+		return invokeObjcSelfClass!(void, "setDefaultFlatness:", CGFloat)(flatness);
+	}
+
+	static CGFloat defaultFlatness ()
+	{
+		return invokeObjcSelfClass!(CGFloat, "defaultFlatness");
+	}
+
+	static void setDefaultWindingRule (uint windingRule)
+	{
+		return invokeObjcSelfClass!(void, "setDefaultWindingRule:", uint)(windingRule);
+	}
+
+	static uint defaultWindingRule ()
+	{
+		return invokeObjcSelfClass!(uint, "defaultWindingRule");
+	}
+
+	static void setDefaultLineCapStyle (uint lineCapStyle)
+	{
+		return invokeObjcSelfClass!(void, "setDefaultLineCapStyle:", uint)(lineCapStyle);
+	}
+
+	static uint defaultLineCapStyle ()
+	{
+		return invokeObjcSelfClass!(uint, "defaultLineCapStyle");
+	}
+
+	static void setDefaultLineJoinStyle (uint lineJoinStyle)
+	{
+		return invokeObjcSelfClass!(void, "setDefaultLineJoinStyle:", uint)(lineJoinStyle);
+	}
+
+	static uint defaultLineJoinStyle ()
+	{
+		return invokeObjcSelfClass!(uint, "defaultLineJoinStyle");
+	}
+
+	static void setDefaultLineWidth (CGFloat lineWidth)
+	{
+		return invokeObjcSelfClass!(void, "setDefaultLineWidth:", CGFloat)(lineWidth);
+	}
+
+	static CGFloat defaultLineWidth ()
+	{
+		return invokeObjcSelfClass!(CGFloat, "defaultLineWidth");
+	}
+
+	void moveToPoint (NSPoint point)
+	{
+		return invokeObjcSelf!(void, "moveToPoint:", NSPoint)(point);
+	}
+
+	void lineToPoint (NSPoint point)
+	{
+		return invokeObjcSelf!(void, "lineToPoint:", NSPoint)(point);
+	}
+
+	void curveToPoint (NSPoint endPoint, NSPoint controlPoint1, NSPoint controlPoint2)
+	{
+		return invokeObjcSelf!(void, "curveToPoint:controlPoint1:controlPoint2:", NSPoint, NSPoint, NSPoint)(endPoint, controlPoint1, controlPoint2);
+	}
+
+	void closePath ()
+	{
+		return invokeObjcSelf!(void, "closePath");
+	}
+
+	void removeAllPoints ()
+	{
+		return invokeObjcSelf!(void, "removeAllPoints");
+	}
+
+	void relativeMoveToPoint (NSPoint point)
+	{
+		return invokeObjcSelf!(void, "relativeMoveToPoint:", NSPoint)(point);
+	}
+
+	void relativeLineToPoint (NSPoint point)
+	{
+		return invokeObjcSelf!(void, "relativeLineToPoint:", NSPoint)(point);
+	}
+
+	void relativeCurveToPoint (NSPoint endPoint, NSPoint controlPoint1, NSPoint controlPoint2)
+	{
+		return invokeObjcSelf!(void, "relativeCurveToPoint:controlPoint1:controlPoint2:", NSPoint, NSPoint, NSPoint)(endPoint, controlPoint1, controlPoint2);
+	}
+
+	CGFloat lineWidth ()
+	{
+		return invokeObjcSelf!(CGFloat, "lineWidth");
+	}
+
+	void setLineWidth (CGFloat lineWidth)
+	{
+		return invokeObjcSelf!(void, "setLineWidth:", CGFloat)(lineWidth);
+	}
+
+	uint lineCapStyle ()
+	{
+		return invokeObjcSelf!(uint, "lineCapStyle");
+	}
+
+	void setLineCapStyle (uint lineCapStyle)
+	{
+		return invokeObjcSelf!(void, "setLineCapStyle:", uint)(lineCapStyle);
+	}
+
+	uint lineJoinStyle ()
+	{
+		return invokeObjcSelf!(uint, "lineJoinStyle");
+	}
+
+	void setLineJoinStyle (uint lineJoinStyle)
+	{
+		return invokeObjcSelf!(void, "setLineJoinStyle:", uint)(lineJoinStyle);
+	}
+
+	uint windingRule ()
+	{
+		return invokeObjcSelf!(uint, "windingRule");
+	}
+
+	void setWindingRule (uint windingRule)
+	{
+		return invokeObjcSelf!(void, "setWindingRule:", uint)(windingRule);
+	}
+
+	CGFloat miterLimit ()
+	{
+		return invokeObjcSelf!(CGFloat, "miterLimit");
+	}
+
+	void setMiterLimit (CGFloat miterLimit)
+	{
+		return invokeObjcSelf!(void, "setMiterLimit:", CGFloat)(miterLimit);
+	}
+
+	CGFloat flatness ()
+	{
+		return invokeObjcSelf!(CGFloat, "flatness");
+	}
+
+	void setFlatness (CGFloat flatness)
+	{
+		return invokeObjcSelf!(void, "setFlatness:", CGFloat)(flatness);
+	}
+
+	void getLineDash (CGFloat* pattern, NSInteger* count, CGFloat* phase)
+	{
+		return invokeObjcSelf!(void, "getLineDash:count:phase:", CGFloat*, NSInteger*, CGFloat*)(pattern, count, phase);
+	}
+
+	void setLineDash (CGFloat* pattern, NSInteger count, CGFloat phase)
+	{
+		return invokeObjcSelf!(void, "setLineDash:count:phase:", CGFloat*, NSInteger, CGFloat)(pattern, count, phase);
+	}
+
+	void stroke ()
+	{
+		return invokeObjcSelf!(void, "stroke");
+	}
+
+	void fill ()
+	{
+		return invokeObjcSelf!(void, "fill");
+	}
+
+	void addClip ()
+	{
+		return invokeObjcSelf!(void, "addClip");
+	}
+
+	void setClip ()
+	{
+		return invokeObjcSelf!(void, "setClip");
+	}
+
+	NSBezierPath bezierPathByFlatteningPath ()
+	{
+		id result = invokeObjcSelf!(id, "bezierPathByFlatteningPath");
+		return result is this.objcObject ? this : (result !is null ? new NSBezierPath(result) : null);
+	}
+
+	NSBezierPath bezierPathByReversingPath ()
+	{
+		id result = invokeObjcSelf!(id, "bezierPathByReversingPath");
+		return result is this.objcObject ? this : (result !is null ? new NSBezierPath(result) : null);
+	}
+
+	void transformUsingAffineTransform (NSAffineTransform transform)
+	{
+		return invokeObjcSelf!(void, "transformUsingAffineTransform:", NSAffineTransform)(transform);
+	}
+
+	bool isEmpty ()
+	{
+		return invokeObjcSelf!(bool, "isEmpty");
+	}
+
+	NSPoint currentPoint ()
+	{
+		return invokeObjcSelf!(NSPoint, "currentPoint");
+	}
+
+	NSRect controlPointBounds ()
+	{
+		return invokeObjcSelf!(NSRect, "controlPointBounds");
+	}
+
+	NSRect bounds ()
+	{
+		return invokeObjcSelf!(NSRect, "bounds");
+	}
+
+	NSInteger elementCount ()
+	{
+		return invokeObjcSelf!(NSInteger, "elementCount");
+	}
+
+	uint elementAtIndex (NSInteger index, NSPointArray points)
+	{
+		return invokeObjcSelf!(uint, "elementAtIndex:associatedPoints:", NSInteger, NSPointArray)(index, points);
+	}
+
+	uint elementAtIndex (NSInteger index)
+	{
+		return invokeObjcSelf!(uint, "elementAtIndex:", NSInteger)(index);
+	}
+
+	void setAssociatedPoints (NSPointArray points, NSInteger index)
+	{
+		return invokeObjcSelf!(void, "setAssociatedPoints:atIndex:", NSPointArray, NSInteger)(points, index);
+	}
+
+	void appendBezierPath (NSBezierPath path)
+	{
+		return invokeObjcSelf!(void, "appendBezierPath:", NSBezierPath)(path);
+	}
+
+	void appendBezierPathWithRect (NSRect rect)
+	{
+		return invokeObjcSelf!(void, "appendBezierPathWithRect:", NSRect)(rect);
+	}
+
+	void appendBezierPathWithPoints (NSPointArray points, NSInteger count)
+	{
+		return invokeObjcSelf!(void, "appendBezierPathWithPoints:count:", NSPointArray, NSInteger)(points, count);
+	}
+
+	void appendBezierPathWithOvalInRect (NSRect rect)
+	{
+		return invokeObjcSelf!(void, "appendBezierPathWithOvalInRect:", NSRect)(rect);
+	}
+
+	void appendBezierPathWithArcWithCenter (NSPoint center, CGFloat radius, CGFloat startAngle, CGFloat endAngle, bool clockwise)
+	{
+		return invokeObjcSelf!(void, "appendBezierPathWithArcWithCenter:radius:startAngle:endAngle:clockwise:", NSPoint, CGFloat, CGFloat, CGFloat, bool)(center, radius, startAngle, endAngle, clockwise);
+	}
+
+	void appendBezierPathWithArcWithCenter (NSPoint center, CGFloat radius, CGFloat startAngle, CGFloat endAngle)
+	{
+		return invokeObjcSelf!(void, "appendBezierPathWithArcWithCenter:radius:startAngle:endAngle:", NSPoint, CGFloat, CGFloat, CGFloat)(center, radius, startAngle, endAngle);
+	}
+
+	void appendBezierPathWithArcFromPoint (NSPoint point1, NSPoint point2, CGFloat radius)
+	{
+		return invokeObjcSelf!(void, "appendBezierPathWithArcFromPoint:toPoint:radius:", NSPoint, NSPoint, CGFloat)(point1, point2, radius);
+	}
+
+	void appendBezierPathWithGlyph (uint glyph, NSFont font)
+	{
+		return invokeObjcSelf!(void, "appendBezierPathWithGlyph:inFont:", uint, NSFont)(glyph, font);
+	}
+
+	void appendBezierPathWithGlyphs (NSGlyph* glyphs, NSInteger count, NSFont font)
+	{
+		return invokeObjcSelf!(void, "appendBezierPathWithGlyphs:count:inFont:", NSGlyph*, NSInteger, NSFont)(glyphs, count, font);
+	}
+
+	void appendBezierPathWithPackedGlyphs (char* packedGlyphs)
+	{
+		return invokeObjcSelf!(void, "appendBezierPathWithPackedGlyphs:", char*)(packedGlyphs);
+	}
+
+	void appendBezierPathWithRoundedRect (NSRect rect, CGFloat xRadius, CGFloat yRadius)
+	{
+		return invokeObjcSelf!(void, "appendBezierPathWithRoundedRect:xRadius:yRadius:", NSRect, CGFloat, CGFloat)(rect, xRadius, yRadius);
+	}
+
+	bool containsPoint (NSPoint point)
+	{
+		return invokeObjcSelf!(bool, "containsPoint:", NSPoint)(point);
+	}
+
+	bool cachesBezierPath ()
+	{
+		return invokeObjcSelf!(bool, "cachesBezierPath");
+	}
+
+	void setCachesBezierPath (bool flag)
+	{
+		return invokeObjcSelf!(void, "setCachesBezierPath:", bool)(flag);
+	}
+
+}
+