1 module spasm.bindings.touchevents; 2 3 import spasm.types; 4 import spasm.bindings.dom; 5 import spasm.bindings.uievents; 6 7 @safe: 8 nothrow: 9 10 struct Touch { 11 nothrow: 12 JsHandle handle; 13 alias handle this; 14 this(Handle h) { 15 this.handle = JsHandle(h); 16 } 17 auto identifier()() { 18 return Touch_identifier_Get(this.handle); 19 } 20 auto target()() { 21 return EventTarget(Touch_target_Get(this.handle)); 22 } 23 auto screenX()() { 24 return Touch_screenX_Get(this.handle); 25 } 26 auto screenY()() { 27 return Touch_screenY_Get(this.handle); 28 } 29 auto clientX()() { 30 return Touch_clientX_Get(this.handle); 31 } 32 auto clientY()() { 33 return Touch_clientY_Get(this.handle); 34 } 35 auto pageX()() { 36 return Touch_pageX_Get(this.handle); 37 } 38 auto pageY()() { 39 return Touch_pageY_Get(this.handle); 40 } 41 auto radiusX()() { 42 return Touch_radiusX_Get(this.handle); 43 } 44 auto radiusY()() { 45 return Touch_radiusY_Get(this.handle); 46 } 47 auto rotationAngle()() { 48 return Touch_rotationAngle_Get(this.handle); 49 } 50 auto force()() { 51 return Touch_force_Get(this.handle); 52 } 53 auto altitudeAngle()() { 54 return Touch_altitudeAngle_Get(this.handle); 55 } 56 auto azimuthAngle()() { 57 return Touch_azimuthAngle_Get(this.handle); 58 } 59 auto touchType()() { 60 return Touch_touchType_Get(this.handle); 61 } 62 } 63 struct TouchEvent { 64 nothrow: 65 spasm.bindings.uievents.UIEvent _parent; 66 alias _parent this; 67 this(Handle h) { 68 _parent = .UIEvent(h); 69 } 70 auto touches()() { 71 return TouchList(TouchEvent_touches_Get(this._parent)); 72 } 73 auto targetTouches()() { 74 return TouchList(TouchEvent_targetTouches_Get(this._parent)); 75 } 76 auto changedTouches()() { 77 return TouchList(TouchEvent_changedTouches_Get(this._parent)); 78 } 79 auto altKey()() { 80 return TouchEvent_altKey_Get(this._parent); 81 } 82 auto metaKey()() { 83 return TouchEvent_metaKey_Get(this._parent); 84 } 85 auto ctrlKey()() { 86 return TouchEvent_ctrlKey_Get(this._parent); 87 } 88 auto shiftKey()() { 89 return TouchEvent_shiftKey_Get(this._parent); 90 } 91 } 92 struct TouchEventInit { 93 nothrow: 94 spasm.bindings.uievents.EventModifierInit _parent; 95 alias _parent this; 96 this(Handle h) { 97 _parent = .EventModifierInit(h); 98 } 99 static auto create() { 100 return TouchEventInit(spasm_add__object()); 101 } 102 void touches()(scope ref Sequence!(Touch) touches) { 103 TouchEventInit_touches_Set(this._parent, touches.handle); 104 } 105 auto touches()() { 106 return Sequence!(Touch)(TouchEventInit_touches_Get(this._parent)); 107 } 108 void targetTouches()(scope ref Sequence!(Touch) targetTouches) { 109 TouchEventInit_targetTouches_Set(this._parent, targetTouches.handle); 110 } 111 auto targetTouches()() { 112 return Sequence!(Touch)(TouchEventInit_targetTouches_Get(this._parent)); 113 } 114 void changedTouches()(scope ref Sequence!(Touch) changedTouches) { 115 TouchEventInit_changedTouches_Set(this._parent, changedTouches.handle); 116 } 117 auto changedTouches()() { 118 return Sequence!(Touch)(TouchEventInit_changedTouches_Get(this._parent)); 119 } 120 } 121 struct TouchInit { 122 nothrow: 123 JsHandle handle; 124 alias handle this; 125 this(Handle h) { 126 this.handle = JsHandle(h); 127 } 128 static auto create() { 129 return TouchInit(spasm_add__object()); 130 } 131 void identifier()(int identifier) { 132 TouchInit_identifier_Set(this.handle, identifier); 133 } 134 auto identifier()() { 135 return TouchInit_identifier_Get(this.handle); 136 } 137 void target()(scope ref EventTarget target) { 138 TouchInit_target_Set(this.handle, target.handle); 139 } 140 auto target()() { 141 return EventTarget(TouchInit_target_Get(this.handle)); 142 } 143 void clientX()(double clientX) { 144 TouchInit_clientX_Set(this.handle, clientX); 145 } 146 auto clientX()() { 147 return TouchInit_clientX_Get(this.handle); 148 } 149 void clientY()(double clientY) { 150 TouchInit_clientY_Set(this.handle, clientY); 151 } 152 auto clientY()() { 153 return TouchInit_clientY_Get(this.handle); 154 } 155 void screenX()(double screenX) { 156 TouchInit_screenX_Set(this.handle, screenX); 157 } 158 auto screenX()() { 159 return TouchInit_screenX_Get(this.handle); 160 } 161 void screenY()(double screenY) { 162 TouchInit_screenY_Set(this.handle, screenY); 163 } 164 auto screenY()() { 165 return TouchInit_screenY_Get(this.handle); 166 } 167 void pageX()(double pageX) { 168 TouchInit_pageX_Set(this.handle, pageX); 169 } 170 auto pageX()() { 171 return TouchInit_pageX_Get(this.handle); 172 } 173 void pageY()(double pageY) { 174 TouchInit_pageY_Set(this.handle, pageY); 175 } 176 auto pageY()() { 177 return TouchInit_pageY_Get(this.handle); 178 } 179 void radiusX()(float radiusX) { 180 TouchInit_radiusX_Set(this.handle, radiusX); 181 } 182 auto radiusX()() { 183 return TouchInit_radiusX_Get(this.handle); 184 } 185 void radiusY()(float radiusY) { 186 TouchInit_radiusY_Set(this.handle, radiusY); 187 } 188 auto radiusY()() { 189 return TouchInit_radiusY_Get(this.handle); 190 } 191 void rotationAngle()(float rotationAngle) { 192 TouchInit_rotationAngle_Set(this.handle, rotationAngle); 193 } 194 auto rotationAngle()() { 195 return TouchInit_rotationAngle_Get(this.handle); 196 } 197 void force()(float force) { 198 TouchInit_force_Set(this.handle, force); 199 } 200 auto force()() { 201 return TouchInit_force_Get(this.handle); 202 } 203 void altitudeAngle()(double altitudeAngle) { 204 TouchInit_altitudeAngle_Set(this.handle, altitudeAngle); 205 } 206 auto altitudeAngle()() { 207 return TouchInit_altitudeAngle_Get(this.handle); 208 } 209 void azimuthAngle()(double azimuthAngle) { 210 TouchInit_azimuthAngle_Set(this.handle, azimuthAngle); 211 } 212 auto azimuthAngle()() { 213 return TouchInit_azimuthAngle_Get(this.handle); 214 } 215 void touchType()(TouchType touchType) { 216 TouchInit_touchType_Set(this.handle, touchType); 217 } 218 auto touchType()() { 219 return TouchInit_touchType_Get(this.handle); 220 } 221 } 222 struct TouchList { 223 nothrow: 224 JsHandle handle; 225 alias handle this; 226 this(Handle h) { 227 this.handle = JsHandle(h); 228 } 229 auto length()() { 230 return TouchList_length_Get(this.handle); 231 } 232 auto item()(uint index) { 233 return TouchList_item_getter(this.handle, index); 234 } 235 } 236 enum TouchType { 237 direct, 238 stylus 239 } 240 241 242 extern (C) int Touch_identifier_Get(Handle); 243 extern (C) Handle Touch_target_Get(Handle); 244 extern (C) double Touch_screenX_Get(Handle); 245 extern (C) double Touch_screenY_Get(Handle); 246 extern (C) double Touch_clientX_Get(Handle); 247 extern (C) double Touch_clientY_Get(Handle); 248 extern (C) double Touch_pageX_Get(Handle); 249 extern (C) double Touch_pageY_Get(Handle); 250 extern (C) float Touch_radiusX_Get(Handle); 251 extern (C) float Touch_radiusY_Get(Handle); 252 extern (C) float Touch_rotationAngle_Get(Handle); 253 extern (C) float Touch_force_Get(Handle); 254 extern (C) float Touch_altitudeAngle_Get(Handle); 255 extern (C) float Touch_azimuthAngle_Get(Handle); 256 extern (C) TouchType Touch_touchType_Get(Handle); 257 extern (C) Handle TouchEvent_touches_Get(Handle); 258 extern (C) Handle TouchEvent_targetTouches_Get(Handle); 259 extern (C) Handle TouchEvent_changedTouches_Get(Handle); 260 extern (C) bool TouchEvent_altKey_Get(Handle); 261 extern (C) bool TouchEvent_metaKey_Get(Handle); 262 extern (C) bool TouchEvent_ctrlKey_Get(Handle); 263 extern (C) bool TouchEvent_shiftKey_Get(Handle); 264 extern (C) void TouchEventInit_touches_Set(Handle, Handle); 265 extern (C) Handle TouchEventInit_touches_Get(Handle); 266 extern (C) void TouchEventInit_targetTouches_Set(Handle, Handle); 267 extern (C) Handle TouchEventInit_targetTouches_Get(Handle); 268 extern (C) void TouchEventInit_changedTouches_Set(Handle, Handle); 269 extern (C) Handle TouchEventInit_changedTouches_Get(Handle); 270 extern (C) void TouchInit_identifier_Set(Handle, int); 271 extern (C) int TouchInit_identifier_Get(Handle); 272 extern (C) void TouchInit_target_Set(Handle, Handle); 273 extern (C) Handle TouchInit_target_Get(Handle); 274 extern (C) void TouchInit_clientX_Set(Handle, double); 275 extern (C) double TouchInit_clientX_Get(Handle); 276 extern (C) void TouchInit_clientY_Set(Handle, double); 277 extern (C) double TouchInit_clientY_Get(Handle); 278 extern (C) void TouchInit_screenX_Set(Handle, double); 279 extern (C) double TouchInit_screenX_Get(Handle); 280 extern (C) void TouchInit_screenY_Set(Handle, double); 281 extern (C) double TouchInit_screenY_Get(Handle); 282 extern (C) void TouchInit_pageX_Set(Handle, double); 283 extern (C) double TouchInit_pageX_Get(Handle); 284 extern (C) void TouchInit_pageY_Set(Handle, double); 285 extern (C) double TouchInit_pageY_Get(Handle); 286 extern (C) void TouchInit_radiusX_Set(Handle, float); 287 extern (C) float TouchInit_radiusX_Get(Handle); 288 extern (C) void TouchInit_radiusY_Set(Handle, float); 289 extern (C) float TouchInit_radiusY_Get(Handle); 290 extern (C) void TouchInit_rotationAngle_Set(Handle, float); 291 extern (C) float TouchInit_rotationAngle_Get(Handle); 292 extern (C) void TouchInit_force_Set(Handle, float); 293 extern (C) float TouchInit_force_Get(Handle); 294 extern (C) void TouchInit_altitudeAngle_Set(Handle, double); 295 extern (C) double TouchInit_altitudeAngle_Get(Handle); 296 extern (C) void TouchInit_azimuthAngle_Set(Handle, double); 297 extern (C) double TouchInit_azimuthAngle_Get(Handle); 298 extern (C) void TouchInit_touchType_Set(Handle, TouchType); 299 extern (C) TouchType TouchInit_touchType_Get(Handle); 300 extern (C) uint TouchList_length_Get(Handle); 301 extern (C) Optional!(Touch) TouchList_item_getter(Handle, uint);