Mercurial > projects > dstep
diff dstep/appkit/NSTextContainer.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/NSTextContainer.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,156 @@ +/** + * 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.NSTextContainer; + +import dstep.appkit.NSLayoutManager; +import dstep.appkit.NSTextView; +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; + +typedef NSUInteger NSLineSweepDirection; +typedef NSUInteger NSLineMovementDirection; + +enum : NSUInteger +{ + NSLineSweepLeft = 0, + NSLineSweepRight = 1, + NSLineSweepDown = 2, + NSLineSweepUp = 3 +} + +enum : NSUInteger +{ + NSLineDoesntMove = 0, + NSLineMovesLeft = 1, + NSLineMovesRight = 2, + NSLineMovesDown = 3, + NSLineMovesUp = 4 +} + +class NSTextContainer : NSObject, 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); + } + + NSTextContainer initWithContainerSize (NSSize size) + { + id result = invokeObjcSelf!(id, "initWithContainerSize:", NSSize)(size); + return result is this.objcObject ? this : (result !is null ? new NSTextContainer(result) : null); + } + + this (NSSize size) + { + super(NSTextContainer.alloc.initWithContainerSize(size).objcObject); + } + + NSLayoutManager layoutManager () + { + return invokeObjcSelf!(NSLayoutManager, "layoutManager"); + } + + void setLayoutManager (NSLayoutManager layoutManager) + { + return invokeObjcSelf!(void, "setLayoutManager:", NSLayoutManager)(layoutManager); + } + + void replaceLayoutManager (NSLayoutManager newLayoutManager) + { + return invokeObjcSelf!(void, "replaceLayoutManager:", NSLayoutManager)(newLayoutManager); + } + + NSTextView textView () + { + return invokeObjcSelf!(NSTextView, "textView"); + } + + void setTextView (NSTextView textView) + { + return invokeObjcSelf!(void, "setTextView:", NSTextView)(textView); + } + + void setWidthTracksTextView (bool flag) + { + return invokeObjcSelf!(void, "setWidthTracksTextView:", bool)(flag); + } + + bool widthTracksTextView () + { + return invokeObjcSelf!(bool, "widthTracksTextView"); + } + + void setHeightTracksTextView (bool flag) + { + return invokeObjcSelf!(void, "setHeightTracksTextView:", bool)(flag); + } + + bool heightTracksTextView () + { + return invokeObjcSelf!(bool, "heightTracksTextView"); + } + + void setContainerSize (NSSize size) + { + return invokeObjcSelf!(void, "setContainerSize:", NSSize)(size); + } + + NSSize containerSize () + { + return invokeObjcSelf!(NSSize, "containerSize"); + } + + void setLineFragmentPadding (CGFloat pad) + { + return invokeObjcSelf!(void, "setLineFragmentPadding:", CGFloat)(pad); + } + + CGFloat lineFragmentPadding () + { + return invokeObjcSelf!(CGFloat, "lineFragmentPadding"); + } + + NSRect lineFragmentRectForProposedRect (NSRect proposedRect, uint sweepDirection, uint movementDirection, NSRectPointer remainingRect) + { + return invokeObjcSelf!(NSRect, "lineFragmentRectForProposedRect:sweepDirection:movementDirection:remainingRect:", NSRect, uint, uint, NSRectPointer)(proposedRect, sweepDirection, movementDirection, remainingRect); + } + + bool isSimpleRectangularTextContainer () + { + return invokeObjcSelf!(bool, "isSimpleRectangularTextContainer"); + } + + bool containsPoint (NSPoint point) + { + return invokeObjcSelf!(bool, "containsPoint:", NSPoint)(point); + } + +} +