comparison dwt/internal/cocoa/DOMMouseEvent.d @ 45:d8635bb48c7c

Merge with SWT 3.5
author Jacob Carlborg <doob@me.com>
date Mon, 01 Dec 2008 17:07:00 +0100
parents f565d3a95c0a
children
comparison
equal deleted inserted replaced
44:ca5e494f2bbf 45:d8635bb48c7c
1 /******************************************************************************* 1 /*******************************************************************************
2 * Copyright (c) 2000, 2008 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * IBM Corporation - initial API and implementation
10 *
2 * Port to the D programming language: 11 * Port to the D programming language:
3 * Jacob Carlborg <jacob.carlborg@gmail.com> 12 * Jacob Carlborg <doob@me.com>
4 *******************************************************************************/ 13 *******************************************************************************/
5 module dwt.internal.cocoa.DOMMouseEvent; 14 module dwt.internal.cocoa.DOMMouseEvent;
6 15
7 import dwt.dwthelper.utils; 16 import dwt.dwthelper.utils;
8 import dwt.internal.cocoa.NSObject; 17 import cocoa = dwt.internal.cocoa.id;
18 import dwt.internal.cocoa.DOMUIEvent;
19 import dwt.internal.cocoa.OS;
20 import objc = dwt.internal.objc.runtime;
9 21
10 public class DOMMouseEvent : NSObject { 22 public class DOMMouseEvent : DOMUIEvent {
11 23
12 public this () { 24 public this() {
13 super(); 25 super();
14 } 26 }
15 27
16 public this (int id) { 28 public this(objc.id id) {
17 super(id); 29 super(id);
18 } 30 }
19 31
20 public bool altKey () { 32 public this(cocoa.id id) {
21 return OS.objc_msgSend(this.id, OS.sel_altKey) !is 0; 33 super(id);
22 } 34 }
23 35
24 public short button () { 36 public bool altKey() {
25 return cast(short) OS.objc_msgSend(this.id, OS.sel_button); 37 return OS.objc_msgSend_bool(this.id, OS.sel_altKey);
26 } 38 }
27 39
28 public int clientX () { 40 public short button() {
29 return OS.objc_msgSend(this.id, OS.sel_clientX); 41 return cast(short)OS.objc_msgSend(this.id, OS.sel_button);
30 } 42 }
31 43
32 public int clientY () { 44 public int clientX() {
33 return OS.objc_msgSend(this.id, OS.sel_clientY); 45 return cast(int)/*64*/OS.objc_msgSend(this.id, OS.sel_clientX);
34 } 46 }
35 47
36 public bool ctrlKey () { 48 public int clientY() {
37 return OS.objc_msgSend(this.id, OS.sel_ctrlKey) !is 0; 49 return cast(int)/*64*/OS.objc_msgSend(this.id, OS.sel_clientY);
38 } 50 }
39 51
40 public int detail () { 52 public bool ctrlKey() {
41 return OS.objc_msgSend(this.id, OS.sel_detail); 53 return OS.objc_msgSend_bool(this.id, OS.sel_ctrlKey);
42 } 54 }
43 55
44 //public void initMouseEvent_______________(NSString initMouseEvent, bool canBubble, bool cancelable, DOMAbstractView view, int detail, int screenX, int screenY, int clientX, int clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, short button, id relatedTarget) { 56 public bool metaKey() {
45 // OS.objc_msgSend(this.id, OS.sel_initMouseEvent_1_1_1_1_1_1_1_1_1_1_1_1_1_1_1, initMouseEvent !is null ? initMouseEvent.id : 0, canBubble, cancelable, view !is null ? view.id : 0, detail, screenX, screenY, clientX, clientY, ctrlKey, altKey, shiftKey, metaKey, button, relatedTarget !is null ? relatedTarget.id : 0); 57 return OS.objc_msgSend_bool(this.id, OS.sel_metaKey);
46 //} 58 }
47 59
48 //public void initMouseEvent_canBubble_cancelable_view_detail_screenX_screenY_clientX_clientY_ctrlKey_altKey_shiftKey_metaKey_button_relatedTarget_(NSString type, bool canBubble, bool cancelable, DOMAbstractView view, int detail, int screenX, int screenY, int clientX, int clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, short button, id relatedTarget) { 60 public bool shiftKey() {
49 // OS.objc_msgSend(this.id, OS.sel_initMouseEvent_1canBubble_1cancelable_1view_1detail_1screenX_1screenY_1clientX_1clientY_1ctrlKey_1altKey_1shiftKey_1metaKey_1button_1relatedTarget_1, type !is null ? type.id : 0, canBubble, cancelable, view !is null ? view.id : 0, detail, screenX, screenY, clientX, clientY, ctrlKey, altKey, shiftKey, metaKey, button, relatedTarget !is null ? relatedTarget.id : 0); 61 return OS.objc_msgSend_bool(this.id, OS.sel_shiftKey);
50 //} 62 }
51
52 public bool metaKey () {
53 return OS.objc_msgSend(this.id, OS.sel_metaKey) !is 0;
54 }
55
56 public id relatedTarget () {
57 int result = OS.objc_msgSend(this.id, OS.sel_relatedTarget);
58 return result !is 0 ? new id(result) : null;
59 }
60
61 public int screenX () {
62 return OS.objc_msgSend(this.id, OS.sel_screenX);
63 }
64
65 public int screenY () {
66 return OS.objc_msgSend(this.id, OS.sel_screenY);
67 }
68
69 public bool shiftKey () {
70 return OS.objc_msgSend(this.id, OS.sel_shiftKey) !is 0;
71 }
72 63
73 } 64 }