Mercurial > projects > dwt-mac
diff dwt/internal/cocoa/DOMKeyboardEvent.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 | f565d3a95c0a |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/cocoa/DOMKeyboardEvent.d Sat Aug 09 17:00:02 2008 +0200 @@ -0,0 +1,57 @@ +/******************************************************************************* + * Port to the D Programming language: + * Jacob Carlborg <jacob.carlborg@gmail.com> + *******************************************************************************/ +module dwt.internal.cocoa.DOMKeyboardEvent; + +import dwt.internal.cocoa.NSObject; +import dwt.internal.cocoa.NSString; +import dwt.internal.cocoa.OS; + +public class DOMKeyboardEvent : NSObject { + + public this () { + super(); + } + + public this (int id) { + super(id); + } + + public bool altKey () { + return OS.objc_msgSend(this.id, OS.sel_altKey) !is 0; + } + + public int charCode () { + return OS.objc_msgSend(this.id, OS.sel_charCode); + } + + public bool ctrlKey () { + return OS.objc_msgSend(this.id, OS.sel_ctrlKey) !is 0; + } + + public bool getModifierState (NSString keyIdentifierArg) { + return OS.objc_msgSend(this.id, OS.sel_getModifierState_1, keyIdentifierArg !is null ? keyIdentifierArg.id : 0) !is 0; + } + + public int keyCode () { + return OS.objc_msgSend(this.id, OS.sel_keyCode); + } + + public int keyLocation () { + return OS.objc_msgSend(this.id, OS.sel_keyLocation); + } + + public bool metaKey () { + return OS.objc_msgSend(this.id, OS.sel_metaKey) !is 0; + } + + public void preventDefault () { + OS.objc_msgSend(this.id, OS.sel_preventDefault); + } + + public bool shiftKey () { + return OS.objc_msgSend(this.id, OS.sel_shiftKey) !is 0; + } + +}