Mercurial > projects > dstep
diff dstep/appkit/NSFormCell.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/NSFormCell.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,157 @@ +/** + * 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.NSFormCell; + +import dstep.appkit.NSActionCell; +import dstep.appkit.NSFont; +import dstep.applicationservices.coregraphics.CGBase; +import dstep.foundation.NSAttributedString; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +const TNSKeyboardUI = ` + + void setTitleWithMnemonic (NSString stringWithAmpersand) + { + return invokeObjcSelf!(void, "setTitleWithMnemonic:", NSString)(stringWithAmpersand); + } + + //mixin ObjcBindMethod!(setTitleWithMnemonic, "setTitleWithMnemonic:"); + +`; + +const TNSFormCellAttributedStringMethods = ` + + NSAttributedString attributedTitle () + { + return invokeObjcSelf!(NSAttributedString, "attributedTitle"); + } + + void setAttributedTitle (NSAttributedString obj) + { + return invokeObjcSelf!(void, "setAttributedTitle:", NSAttributedString)(obj); + } + + //mixin ObjcBindMethod!(attributedTitle, "attributedTitle"); + //mixin ObjcBindMethod!(setAttributedTitle, "setAttributedTitle:"); + +`; + +class NSFormCell : NSActionCell +{ + mixin (ObjcWrap); + + NSFormCell initTextCell (NSString aString) + { + id result = invokeObjcSelf!(id, "initTextCell:", NSString)(aString); + return result is this.objcObject ? this : (result !is null ? new NSFormCell(result) : null); + } + + this (NSString aString) + { + super(NSFormCell.alloc.initTextCell(aString).objcObject); + } + + CGFloat titleWidth (NSSize aSize) + { + return invokeObjcSelf!(CGFloat, "titleWidth:", NSSize)(aSize); + } + + CGFloat titleWidth () + { + return invokeObjcSelf!(CGFloat, "titleWidth"); + } + + void setTitleWidth (CGFloat width) + { + return invokeObjcSelf!(void, "setTitleWidth:", CGFloat)(width); + } + + NSString title () + { + return invokeObjcSelf!(NSString, "title"); + } + + void setTitle (NSString aString) + { + return invokeObjcSelf!(void, "setTitle:", NSString)(aString); + } + + NSFont titleFont () + { + return invokeObjcSelf!(NSFont, "titleFont"); + } + + void setTitleFont (NSFont fontObj) + { + return invokeObjcSelf!(void, "setTitleFont:", NSFont)(fontObj); + } + + uint titleAlignment () + { + return invokeObjcSelf!(uint, "titleAlignment"); + } + + void setTitleAlignment (uint mode) + { + return invokeObjcSelf!(void, "setTitleAlignment:", uint)(mode); + } + + bool isOpaque () + { + return invokeObjcSelf!(bool, "isOpaque"); + } + + void setPlaceholderString (NSString string) + { + return invokeObjcSelf!(void, "setPlaceholderString:", NSString)(string); + } + + NSString placeholderString () + { + return invokeObjcSelf!(NSString, "placeholderString"); + } + + void setPlaceholderAttributedString (NSAttributedString string) + { + return invokeObjcSelf!(void, "setPlaceholderAttributedString:", NSAttributedString)(string); + } + + NSAttributedString placeholderAttributedString () + { + return invokeObjcSelf!(NSAttributedString, "placeholderAttributedString"); + } + + int titleBaseWritingDirection () + { + return invokeObjcSelf!(int, "titleBaseWritingDirection"); + } + + void setTitleBaseWritingDirection (int writingDirection) + { + return invokeObjcSelf!(void, "setTitleBaseWritingDirection:", int)(writingDirection); + } + + // NSKeyboardUI + void setTitleWithMnemonic (NSString stringWithAmpersand) + { + return invokeObjcSelf!(void, "setTitleWithMnemonic:", NSString)(stringWithAmpersand); + } + + // NSFormCellAttributedStringMethods + NSAttributedString attributedTitle () + { + return invokeObjcSelf!(NSAttributedString, "attributedTitle"); + } + + void setAttributedTitle (NSAttributedString obj) + { + return invokeObjcSelf!(void, "setAttributedTitle:", NSAttributedString)(obj); + } +} \ No newline at end of file