Mercurial > projects > dwt-mac
diff dwt/internal/cocoa/DOMEvent.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/DOMEvent.d Sat Aug 09 17:00:02 2008 +0200 @@ -0,0 +1,69 @@ +/******************************************************************************* + * Port to the D Programming language: + * Jacob Carlborg <jacob.carlborg@gmail.com> + *******************************************************************************/ +module dwt.internal.cocoa.DOMEvent; + +import dwt.internal.cocoa.NSObject; +import dwt.internal.cocoa.NSString; +import dwt.internal.cocoa.OS; +import objc = dwt.internal.objc.objc : id; + +public class DOMEvent : NSObject { + + public this () { + super(); + } + + public this (objc.id id) { + super(id); + } + + public bool bubbles () { + return OS.objc_msgSend(this.id, OS.sel_bubbles) !is null; + } + + public bool cancelable () { + return OS.objc_msgSend(this.id, OS.sel_cancelable) !is null; + } + + public id currentTarget () { + objc.id result = OS.objc_msgSend(this.id, OS.sel_currentTarget); + return result !is null ? new id(result) : null; + } + + public short eventPhase () { + return cast(short) OS.objc_msgSend(this.id, OS.sel_eventPhase); + } + + public void initEvent___ (NSString initEvent, bool canBubbleArg, bool cancelableArg) { + OS.objc_msgSend(this.id, OS.sel_initEvent_1_1_1, initEvent !is null ? initEvent.id : null, canBubbleArg, cancelableArg); + } + + public void initEvent_canBubbleArg_cancelableArg_ (NSString eventTypeArg, bool canBubbleArg, bool cancelableArg) { + OS.objc_msgSend(this.id, OS.sel_initEvent_1canBubbleArg_1cancelableArg_1, eventTypeArg !is null ? eventTypeArg.id : null, canBubbleArg, + cancelableArg); + } + + public void preventDefault () { + OS.objc_msgSend(this.id, OS.sel_preventDefault); + } + + public void stopPropagation () { + OS.objc_msgSend(this.id, OS.sel_stopPropagation); + } + + public id target () { + objc.id result = OS.objc_msgSend(this.id, OS.sel_target); + return result !is null ? new id(result) : null; + } + + public long timeStamp () { + return cast(long) OS.objc_msgSend(this.id, OS.sel_timeStamp); + } + + public NSString type () { + objc.id result = OS.objc_msgSend(this.id, OS.sel_type); + return result !is null ? new NSString(result) : null; + } +}