Mercurial > projects > dstep
view dstep/appkit/NSText.d @ 22:f8a3b67adfcb
Removed duplicated methods
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Tue, 09 Feb 2010 18:02:03 +0100 |
parents | 19885b43130e |
children | b9de51448c6b |
line wrap: on
line source
/** * 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.NSText; import dstep.appkit.NSColor; import dstep.appkit.NSFont; import dstep.appkit.NSSpellProtocol; import dstep.appkit.NSView; import dstep.foundation.NSData; import dstep.foundation.NSGeometry; import dstep.foundation.NSNotification; import dstep.foundation.NSObjCRuntime; import dstep.foundation.NSRange; import dstep.foundation.NSString; import dstep.objc.bridge.Bridge; import dstep.objc.objc; import bindings = dstep.appkit.NSText_bindings; typedef NSUInteger NSTextAlignment; typedef NSInteger NSWritingDirection; private { NSString NSTextDidBeginEditingNotification_; NSString NSTextDidEndEditingNotification_; NSString NSTextDidChangeNotification_; } NSString NSTextDidBeginEditingNotification () { if (NSTextDidBeginEditingNotification_) return NSTextDidBeginEditingNotification_; return NSTextDidBeginEditingNotification_ = new NSString(bindings.NSTextDidBeginEditingNotification); } NSString NSTextDidEndEditingNotification () { if (NSTextDidEndEditingNotification_) return NSTextDidEndEditingNotification_; return NSTextDidEndEditingNotification_ = new NSString(bindings.NSTextDidEndEditingNotification); } NSString NSTextDidChangeNotification () { if (NSTextDidChangeNotification_) return NSTextDidChangeNotification_; return NSTextDidChangeNotification_ = new NSString(bindings.NSTextDidChangeNotification); } enum { NSEnterCharacter = 0x0003, NSBackspaceCharacter = 0x0008, NSTabCharacter = 0x0009, NSNewlineCharacter = 0x000a, NSFormFeedCharacter = 0x000c, NSCarriageReturnCharacter = 0x000d, NSBackTabCharacter = 0x0019, NSDeleteCharacter = 0x007f, NSLineSeparatorCharacter = 0x2028, NSParagraphSeparatorCharacter = 0x2029 } enum : NSUInteger { NSLeftTextAlignment = 0, NSRightTextAlignment = 1, NSCenterTextAlignment = 2, NSJustifiedTextAlignment = 3, NSNaturalTextAlignment = 4 } enum : NSInteger { NSWritingDirectionNatural = -1, NSWritingDirectionLeftToRight = 0, NSWritingDirectionRightToLeft = 1 } enum { NSIllegalTextMovement = 0, NSReturnTextMovement = 0x10, NSTabTextMovement = 0x11, NSBacktabTextMovement = 0x12, NSLeftTextMovement = 0x13, NSRightTextMovement = 0x14, NSUpTextMovement = 0x15, NSDownTextMovement = 0x16, NSCancelTextMovement = 0x17, NSOtherTextMovement = 0 } class NSText : NSView, INSChangeSpelling, INSIgnoreMisspelledWords { mixin (ObjcWrap); NSString string () { return invokeObjcSelf!(NSString, "string"); } void setString (NSString string) { return invokeObjcSelf!(void, "setString:", NSString)(string); } void replaceCharactersInRange (NSRange range, NSString aString) { return invokeObjcSelf!(void, "replaceCharactersInRange:withString:", NSRange, NSString)(range, aString); } void replaceCharactersInRange (NSRange range, NSData rtfData) { return invokeObjcSelf!(void, "replaceCharactersInRange:withRTF:", NSRange, NSData)(range, rtfData); } void replaceCharactersInRange_withRTFD (NSRange range, NSData rtfdData) { return invokeObjcSelf!(void, "replaceCharactersInRange:withRTFD:", NSRange, NSData)(range, rtfdData); } NSData RTFFromRange (NSRange range) { return invokeObjcSelf!(NSData, "RTFFromRange:", NSRange)(range); } NSData RTFDFromRange (NSRange range) { return invokeObjcSelf!(NSData, "RTFDFromRange:", NSRange)(range); } bool writeRTFDToFile (NSString path, bool flag) { return invokeObjcSelf!(bool, "writeRTFDToFile:atomically:", NSString, bool)(path, flag); } bool readRTFDFromFile (NSString path) { return invokeObjcSelf!(bool, "readRTFDFromFile:", NSString)(path); } Object delegate_ () { return invokeObjcSelf!(Object, "delegate"); } void setDelegate (Object anObject) { return invokeObjcSelf!(void, "setDelegate:", Object)(anObject); } bool isEditable () { return invokeObjcSelf!(bool, "isEditable"); } void setEditable (bool flag) { return invokeObjcSelf!(void, "setEditable:", bool)(flag); } bool isSelectable () { return invokeObjcSelf!(bool, "isSelectable"); } void setSelectable (bool flag) { return invokeObjcSelf!(void, "setSelectable:", bool)(flag); } bool isRichText () { return invokeObjcSelf!(bool, "isRichText"); } void setRichText (bool flag) { return invokeObjcSelf!(void, "setRichText:", bool)(flag); } bool importsGraphics () { return invokeObjcSelf!(bool, "importsGraphics"); } void setImportsGraphics (bool flag) { return invokeObjcSelf!(void, "setImportsGraphics:", bool)(flag); } bool isFieldEditor () { return invokeObjcSelf!(bool, "isFieldEditor"); } void setFieldEditor (bool flag) { return invokeObjcSelf!(void, "setFieldEditor:", bool)(flag); } bool usesFontPanel () { return invokeObjcSelf!(bool, "usesFontPanel"); } void setUsesFontPanel (bool flag) { return invokeObjcSelf!(void, "setUsesFontPanel:", bool)(flag); } bool drawsBackground () { return invokeObjcSelf!(bool, "drawsBackground"); } void setDrawsBackground (bool flag) { return invokeObjcSelf!(void, "setDrawsBackground:", bool)(flag); } NSColor backgroundColor () { return invokeObjcSelf!(NSColor, "backgroundColor"); } void setBackgroundColor (NSColor color) { return invokeObjcSelf!(void, "setBackgroundColor:", NSColor)(color); } bool isRulerVisible () { return invokeObjcSelf!(bool, "isRulerVisible"); } NSRange selectedRange () { return invokeObjcSelf!(NSRange, "selectedRange"); } void setSelectedRange (NSRange range) { return invokeObjcSelf!(void, "setSelectedRange:", NSRange)(range); } void scrollRangeToVisible (NSRange range) { return invokeObjcSelf!(void, "scrollRangeToVisible:", NSRange)(range); } void setFont (NSFont obj) { return invokeObjcSelf!(void, "setFont:", NSFont)(obj); } NSFont font () { return invokeObjcSelf!(NSFont, "font"); } void setTextColor (NSColor color) { return invokeObjcSelf!(void, "setTextColor:", NSColor)(color); } NSColor textColor () { return invokeObjcSelf!(NSColor, "textColor"); } uint alignment () { return invokeObjcSelf!(uint, "alignment"); } void setAlignment (uint mode) { return invokeObjcSelf!(void, "setAlignment:", uint)(mode); } int baseWritingDirection () { return invokeObjcSelf!(int, "baseWritingDirection"); } void setBaseWritingDirection (int writingDirection) { return invokeObjcSelf!(void, "setBaseWritingDirection:", int)(writingDirection); } void setTextColor (NSColor color, NSRange range) { return invokeObjcSelf!(void, "setTextColor:range:", NSColor, NSRange)(color, range); } void setFont (NSFont font, NSRange range) { return invokeObjcSelf!(void, "setFont:range:", NSFont, NSRange)(font, range); } NSSize maxSize () { return invokeObjcSelf!(NSSize, "maxSize"); } void setMaxSize (NSSize newMaxSize) { return invokeObjcSelf!(void, "setMaxSize:", NSSize)(newMaxSize); } NSSize minSize () { return invokeObjcSelf!(NSSize, "minSize"); } void setMinSize (NSSize newMinSize) { return invokeObjcSelf!(void, "setMinSize:", NSSize)(newMinSize); } bool isHorizontallyResizable () { return invokeObjcSelf!(bool, "isHorizontallyResizable"); } void setHorizontallyResizable (bool flag) { return invokeObjcSelf!(void, "setHorizontallyResizable:", bool)(flag); } bool isVerticallyResizable () { return invokeObjcSelf!(bool, "isVerticallyResizable"); } void setVerticallyResizable (bool flag) { return invokeObjcSelf!(void, "setVerticallyResizable:", bool)(flag); } void sizeToFit () { return invokeObjcSelf!(void, "sizeToFit"); } void copy (Object sender) { return invokeObjcSelf!(void, "copy:", Object)(sender); } void copyFont (Object sender) { return invokeObjcSelf!(void, "copyFont:", Object)(sender); } void copyRuler (Object sender) { return invokeObjcSelf!(void, "copyRuler:", Object)(sender); } void cut (Object sender) { return invokeObjcSelf!(void, "cut:", Object)(sender); } void delete_ (Object sender) { return invokeObjcSelf!(void, "delete:", Object)(sender); } void paste (Object sender) { return invokeObjcSelf!(void, "paste:", Object)(sender); } void pasteFont (Object sender) { return invokeObjcSelf!(void, "pasteFont:", Object)(sender); } void pasteRuler (Object sender) { return invokeObjcSelf!(void, "pasteRuler:", Object)(sender); } void selectAll (Object sender) { return invokeObjcSelf!(void, "selectAll:", Object)(sender); } void changeFont (Object sender) { return invokeObjcSelf!(void, "changeFont:", Object)(sender); } void alignLeft (Object sender) { return invokeObjcSelf!(void, "alignLeft:", Object)(sender); } void alignRight (Object sender) { return invokeObjcSelf!(void, "alignRight:", Object)(sender); } void alignCenter (Object sender) { return invokeObjcSelf!(void, "alignCenter:", Object)(sender); } void subscript (Object sender) { return invokeObjcSelf!(void, "subscript:", Object)(sender); } void superscript (Object sender) { return invokeObjcSelf!(void, "superscript:", Object)(sender); } void underline (Object sender) { return invokeObjcSelf!(void, "underline:", Object)(sender); } void unscript (Object sender) { return invokeObjcSelf!(void, "unscript:", Object)(sender); } void showGuessPanel (Object sender) { return invokeObjcSelf!(void, "showGuessPanel:", Object)(sender); } void checkSpelling (Object sender) { return invokeObjcSelf!(void, "checkSpelling:", Object)(sender); } void toggleRuler (Object sender) { return invokeObjcSelf!(void, "toggleRuler:", Object)(sender); } void changeSpelling (Object sender) { return invokeObjcSelf!(void, "changeSpelling:", Object)(sender); } void ignoreSpelling (Object sender) { return invokeObjcSelf!(void, "ignoreSpelling:", Object)(sender); } } const TNSTextDelegate = ` bool textShouldBeginEditing (NSText textObject) { return invokeObjcSelf!(bool, "textShouldBeginEditing:", NSText)(textObject); } bool textShouldEndEditing (NSText textObject) { return invokeObjcSelf!(bool, "textShouldEndEditing:", NSText)(textObject); } void textDidBeginEditing (NSNotification notification) { return invokeObjcSelf!(void, "textDidBeginEditing:", NSNotification)(notification); } void textDidEndEditing (NSNotification notification) { return invokeObjcSelf!(void, "textDidEndEditing:", NSNotification)(notification); } void textDidChange (NSNotification notification) { return invokeObjcSelf!(void, "textDidChange:", NSNotification)(notification); } //mixin ObjcBindMethod!(textShouldBeginEditing, "textShouldBeginEditing:"); //mixin ObjcBindMethod!(textShouldEndEditing, "textShouldEndEditing:"); //mixin ObjcBindMethod!(textDidBeginEditing, "textDidBeginEditing:"); //mixin ObjcBindMethod!(textDidEndEditing, "textDidEndEditing:"); //mixin ObjcBindMethod!(textDidChange, "textDidChange:"); `;