Mercurial > projects > dwt-mac
diff dwt/internal/cocoa/NSTextField.d @ 0:380af2bdd8e5
Upload of whole dwt tree
author | Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com> |
---|---|
date | Sat, 09 Aug 2008 17:00:02 +0200 |
parents | |
children | 8b48be5454ce |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/cocoa/NSTextField.d Sat Aug 09 17:00:02 2008 +0200 @@ -0,0 +1,192 @@ +/******************************************************************************* + * Copyright (c) 2007 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + * + * Port to the D Programming language: + * Jacob Carlborg <jacob.carlborg@gmail.com> + *******************************************************************************/ +module dwt.internal.cocoa.NSTextField; + +import dwt.internal.cocoa.id; +import dwt.internal.cocoa.NSColor; +import dwt.internal.cocoa.NSControl; +import dwt.internal.cocoa.NSNotification; +import dwt.internal.cocoa.NSString; +import dwt.internal.cocoa.NSText; +import dwt.internal.cocoa.NSTextFieldCell : NSTextFieldBezelStyle; +import dwt.internal.cocoa.OS; +import objc = dwt.internal.objc.runtime; + +public class NSTextField : NSControl +{ + + public this () + { + super(); + } + + public this (objc.id id) + { + super(id); + } + + public bool acceptsFirstResponder () + { + return OS.objc_msgSend(this.id, OS.sel_acceptsFirstResponder) !is null; + } + + public bool allowsEditingTextAttributes () + { + return OS.objc_msgSend(this.id, OS.sel_allowsEditingTextAttributes) !is null; + } + + public NSColor backgroundColor () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_backgroundColor); + return result !is null ? new NSColor(result) : null; + } + + public NSTextFieldBezelStyl bezelStyle () + { + return cast(NSTextFieldBezelStyle) OS.objc_msgSend(this.id, OS.sel_bezelStyle); + } + + public id delegatee () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_delegate); + return result !is null ? new id(result) : null; + } + + public bool drawsBackground () + { + return OS.objc_msgSend(this.id, OS.sel_drawsBackground) !is null; + } + + public bool importsGraphics () + { + return OS.objc_msgSend(this.id, OS.sel_importsGraphics) !is null; + } + + public bool isBezeled () + { + return OS.objc_msgSend(this.id, OS.sel_isBezeled) !is null; + } + + public bool isBordered () + { + return OS.objc_msgSend(this.id, OS.sel_isBordered) !is null; + } + + public bool isEditable () + { + return OS.objc_msgSend(this.id, OS.sel_isEditable) !is null; + } + + public bool isSelectable () + { + return OS.objc_msgSend(this.id, OS.sel_isSelectable) !is null; + } + + public void selectText (id sender) + { + OS.objc_msgSend(this.id, OS.sel_selectText_1, sender !is null ? sender.id : null); + } + + public void setAllowsEditingTextAttributes (bool flag) + { + OS.objc_msgSend(this.id, OS.sel_setAllowsEditingTextAttributes_1, flag); + } + + public void setBackgroundColor (NSColor color) + { + OS.objc_msgSend(this.id, OS.sel_setBackgroundColor_1, color !is null ? color.id : null); + } + + public void setBezelStyle (NSTextFieldBezelStyle style) + { + OS.objc_msgSend(this.id, OS.sel_setBezelStyle_1, style); + } + + public void setBezeled (bool flag) + { + OS.objc_msgSend(this.id, OS.sel_setBezeled_1, flag); + } + + public void setBordered (bool flag) + { + OS.objc_msgSend(this.id, OS.sel_setBordered_1, flag); + } + + public void setDelegate (id anObject) + { + OS.objc_msgSend(this.id, OS.sel_setDelegate_1, anObject !is null ? anObject.id : null); + } + + public void setDrawsBackground (bool flag) + { + OS.objc_msgSend(this.id, OS.sel_setDrawsBackground_1, flag); + } + + public void setEditable (bool flag) + { + OS.objc_msgSend(this.id, OS.sel_setEditable_1, flag); + } + + public void setImportsGraphics (bool flag) + { + OS.objc_msgSend(this.id, OS.sel_setImportsGraphics_1, flag); + } + + public void setSelectable (bool flag) + { + OS.objc_msgSend(this.id, OS.sel_setSelectable_1, flag); + } + + public void setTextColor (NSColor color) + { + OS.objc_msgSend(this.id, OS.sel_setTextColor_1, color !is null ? color.id : null); + } + + public void setTitleWithMnemonic (NSString stringWithAmpersand) + { + OS.objc_msgSend(this.id, OS.sel_setTitleWithMnemonic_1, stringWithAmpersand !is null ? stringWithAmpersand.id : null); + } + + public NSColor textColor () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_textColor); + return result !is null ? new NSColor(result) : null; + } + + public void textDidBeginEditing (NSNotification notification) + { + OS.objc_msgSend(this.id, OS.sel_textDidBeginEditing_1, notification !is null ? notification.id : null); + } + + public void textDidChange (NSNotification notification) + { + OS.objc_msgSend(this.id, OS.sel_textDidChange_1, notification !is null ? notification.id : null); + } + + public void textDidEndEditing (NSNotification notification) + { + OS.objc_msgSend(this.id, OS.sel_textDidEndEditing_1, notification !is null ? notification.id : null); + } + + public bool textShouldBeginEditing (NSText textObject) + { + return OS.objc_msgSend(this.id, OS.sel_textShouldBeginEditing_1, textObject !is null ? textObject.id : null) !is null; + } + + public bool textShouldEndEditing (NSText textObject) + { + return OS.objc_msgSend(this.id, OS.sel_textShouldEndEditing_1, textObject !is null ? textObject.id : null) !is null; + } + +}