/android/generated/glue/android.view.MotionEvent.cpp

https://bitbucket.org/festevezga/xobotos · C++ · 700 lines · 616 code · 84 blank · 0 comment · 40 complexity · 7441af87232dcc8b239ccf4d4c07e754 MD5 · raw file

  1. #include "android.view.MotionEvent.h"
  2. extern "C" DLL_EXPORT void
  3. libxobotos_android_view_MotionEvent_destructor(MotionEventGlue* ptr)
  4. {
  5. delete ptr;
  6. }
  7. struct PointerCoords_Struct
  8. {
  9. uint32_t _owner;
  10. long packedAxisBits;
  11. Array_float_Struct* packedAxisValues;
  12. float x;
  13. float y;
  14. float pressure;
  15. float size;
  16. float touchMajor;
  17. float touchMinor;
  18. float toolMajor;
  19. float toolMinor;
  20. float orientation;
  21. };
  22. void
  23. PointerCoords_Helper::unwrap(MotionEventGlue::Coords& from, PointerCoords_Struct*
  24. to)
  25. {
  26. to->_owner = 0x7380548b;
  27. to->packedAxisBits = from.packedAxisBits;
  28. to->packedAxisValues = Array_float_Helper::unwrap(from.packedAxisValues);
  29. to->x = from.x;
  30. to->y = from.y;
  31. to->pressure = from.pressure;
  32. to->size = from.size;
  33. to->touchMajor = from.touchMajor;
  34. to->touchMinor = from.touchMinor;
  35. to->toolMajor = from.toolMajor;
  36. to->toolMinor = from.toolMinor;
  37. to->orientation = from.orientation;
  38. }
  39. PointerCoords_Struct*
  40. PointerCoords_Helper::unwrap(MotionEventGlue::Coords* src)
  41. {
  42. if (src == NULL)
  43. {
  44. return NULL;
  45. }
  46. PointerCoords_Struct* retval = new PointerCoords_Struct();
  47. PointerCoords_Helper::unwrap(*src, retval);
  48. return retval;
  49. }
  50. void
  51. PointerCoords_Helper::marshalOut(const MotionEventGlue::Coords& from, PointerCoords_Struct*
  52. to)
  53. {
  54. to->packedAxisBits = from.packedAxisBits;
  55. Array_float_Helper::marshalOut(*from.packedAxisValues, to->packedAxisValues);
  56. to->x = from.x;
  57. to->y = from.y;
  58. to->pressure = from.pressure;
  59. to->size = from.size;
  60. to->touchMajor = from.touchMajor;
  61. to->touchMinor = from.touchMinor;
  62. to->toolMajor = from.toolMajor;
  63. to->toolMinor = from.toolMinor;
  64. to->orientation = from.orientation;
  65. }
  66. void
  67. PointerCoords_Helper::wrap(const PointerCoords_Struct& from, MotionEventGlue::Coords*
  68. to)
  69. {
  70. to->packedAxisBits = from.packedAxisBits;
  71. to->packedAxisValues = Array_float_Helper::wrap(from.packedAxisValues);
  72. to->x = from.x;
  73. to->y = from.y;
  74. to->pressure = from.pressure;
  75. to->size = from.size;
  76. to->touchMajor = from.touchMajor;
  77. to->touchMinor = from.touchMinor;
  78. to->toolMajor = from.toolMajor;
  79. to->toolMinor = from.toolMinor;
  80. to->orientation = from.orientation;
  81. }
  82. MotionEventGlue::Coords*
  83. PointerCoords_Helper::wrap(const PointerCoords_Struct* src)
  84. {
  85. if (src == NULL)
  86. {
  87. return NULL;
  88. }
  89. MotionEventGlue::Coords* retval = new MotionEventGlue::Coords();
  90. PointerCoords_Helper::wrap(*src, retval);
  91. return retval;
  92. }
  93. const MotionEventGlue::Coords*
  94. PointerCoords_Helper::wrapConst(const PointerCoords_Struct* src)
  95. {
  96. return const_cast<const MotionEventGlue::Coords*>(PointerCoords_Helper::wrap(src));
  97. }
  98. void
  99. PointerCoords_Helper::freeMembers(PointerCoords_Struct& obj)
  100. {
  101. assert(obj._owner == 0x7380548b);
  102. Array_float_Helper::destructor(obj.packedAxisValues);
  103. }
  104. void
  105. PointerCoords_Helper::destructor(PointerCoords_Struct* obj)
  106. {
  107. if (obj == NULL)
  108. {
  109. return;
  110. }
  111. PointerCoords_Helper::freeMembers(*obj);
  112. delete obj;
  113. }
  114. extern "C" DLL_EXPORT void
  115. libxobotos_android_view_MotionEvent_PointerCoords_destructor(PointerCoords_Struct*
  116. obj)
  117. {
  118. PointerCoords_Helper::destructor(obj);
  119. }
  120. struct PointerProperties_Struct
  121. {
  122. uint32_t _owner;
  123. int id;
  124. int toolType;
  125. };
  126. void
  127. PointerProperties_Helper::unwrap(MotionEventGlue::Properties& from, PointerProperties_Struct*
  128. to)
  129. {
  130. to->_owner = 0x7380548b;
  131. to->id = from.id;
  132. to->toolType = from.toolType;
  133. }
  134. PointerProperties_Struct*
  135. PointerProperties_Helper::unwrap(MotionEventGlue::Properties* src)
  136. {
  137. if (src == NULL)
  138. {
  139. return NULL;
  140. }
  141. PointerProperties_Struct* retval = new PointerProperties_Struct();
  142. PointerProperties_Helper::unwrap(*src, retval);
  143. return retval;
  144. }
  145. void
  146. PointerProperties_Helper::marshalOut(const MotionEventGlue::Properties& from, PointerProperties_Struct*
  147. to)
  148. {
  149. to->id = from.id;
  150. to->toolType = from.toolType;
  151. }
  152. void
  153. PointerProperties_Helper::wrap(const PointerProperties_Struct& from, MotionEventGlue::Properties*
  154. to)
  155. {
  156. to->id = from.id;
  157. to->toolType = from.toolType;
  158. }
  159. MotionEventGlue::Properties*
  160. PointerProperties_Helper::wrap(const PointerProperties_Struct* src)
  161. {
  162. if (src == NULL)
  163. {
  164. return NULL;
  165. }
  166. MotionEventGlue::Properties* retval = new MotionEventGlue::Properties();
  167. PointerProperties_Helper::wrap(*src, retval);
  168. return retval;
  169. }
  170. const MotionEventGlue::Properties*
  171. PointerProperties_Helper::wrapConst(const PointerProperties_Struct* src)
  172. {
  173. return const_cast<const MotionEventGlue::Properties*>(PointerProperties_Helper::wrap
  174. (src));
  175. }
  176. void
  177. PointerProperties_Helper::freeMembers(PointerProperties_Struct& obj)
  178. {
  179. assert(obj._owner == 0x7380548b);
  180. }
  181. void
  182. PointerProperties_Helper::destructor(PointerProperties_Struct* obj)
  183. {
  184. if (obj == NULL)
  185. {
  186. return;
  187. }
  188. PointerProperties_Helper::freeMembers(*obj);
  189. delete obj;
  190. }
  191. extern "C" DLL_EXPORT void
  192. libxobotos_android_view_MotionEvent_PointerProperties_destructor(PointerProperties_Struct*
  193. obj)
  194. {
  195. PointerProperties_Helper::destructor(obj);
  196. }
  197. struct Array_PointerProperties_Struct
  198. {
  199. uint32_t _owner;
  200. uint32_t length;
  201. PointerProperties_Struct* ptr;
  202. };
  203. class Array_PointerProperties_Helper
  204. {
  205. public:
  206. static void
  207. unwrap(NativeArray<MotionEventGlue::Properties>& from, Array_PointerProperties_Struct*
  208. to)
  209. {
  210. to->_owner = 0x7380548b;
  211. to->length = from.length();
  212. {
  213. to->ptr = MarshalHelper::allocArray<PointerProperties_Struct>(from.length());
  214. for(uint32_t i = 0; i < from.length(); i++)
  215. {
  216. PointerProperties_Helper::unwrap(from.item(i), &(to->ptr[i]));
  217. }
  218. }
  219. }
  220. static Array_PointerProperties_Struct*
  221. unwrap(NativeArray<MotionEventGlue::Properties>* src)
  222. {
  223. if (src == NULL)
  224. {
  225. return NULL;
  226. }
  227. Array_PointerProperties_Struct* retval = new Array_PointerProperties_Struct();
  228. Array_PointerProperties_Helper::unwrap(*src, retval);
  229. return retval;
  230. }
  231. static void
  232. marshalOut(const NativeArray<MotionEventGlue::Properties>& from, Array_PointerProperties_Struct*
  233. to)
  234. {
  235. assert(from.length() == to->length);
  236. for(uint32_t i = 0; i < from.length(); i++)
  237. {
  238. PointerProperties_Helper::marshalOut(from.item(i), &(to->ptr[i]));
  239. }
  240. }
  241. static void
  242. wrap(const Array_PointerProperties_Struct& from, NativeArray<MotionEventGlue::Properties>*
  243. to)
  244. {
  245. assert(from.length == to->length());
  246. for(uint32_t i = 0; i < from.length; i++)
  247. {
  248. PointerProperties_Helper::wrap(from.ptr[i], &(to->item(i)));
  249. }
  250. }
  251. static NativeArray<MotionEventGlue::Properties>*
  252. wrap(const Array_PointerProperties_Struct* src)
  253. {
  254. if (src == NULL)
  255. {
  256. return NULL;
  257. }
  258. NativeArray<MotionEventGlue::Properties>* retval = new NativeArray<MotionEventGlue::Properties>
  259. (src->length);
  260. Array_PointerProperties_Helper::wrap(*src, retval);
  261. return retval;
  262. }
  263. static const NativeArray<MotionEventGlue::Properties>*
  264. wrapConst(const Array_PointerProperties_Struct* src)
  265. {
  266. return const_cast<const NativeArray<MotionEventGlue::Properties>*>(Array_PointerProperties_Helper
  267. ::wrap(src));
  268. }
  269. static void
  270. freeMembers(Array_PointerProperties_Struct& obj)
  271. {
  272. assert(obj._owner == 0x7380548b);
  273. {
  274. for(uint32_t i = 0; i < obj.length; i++)
  275. {
  276. PointerProperties_Helper::freeMembers(obj.ptr[i]);
  277. }
  278. MarshalHelper::freeArray<PointerProperties_Struct>(obj.ptr, obj.length);
  279. }
  280. }
  281. static void
  282. destructor(Array_PointerProperties_Struct* obj)
  283. {
  284. if (obj == NULL)
  285. {
  286. return;
  287. }
  288. Array_PointerProperties_Helper::freeMembers(*obj);
  289. delete obj;
  290. }
  291. private:
  292. Array_PointerProperties_Helper();
  293. };
  294. extern "C" DLL_EXPORT void
  295. libxobotos_android_view_MotionEvent_Array_PointerProperties_destructor(Array_PointerProperties_Struct*
  296. obj)
  297. {
  298. Array_PointerProperties_Helper::destructor(obj);
  299. }
  300. struct Array_PointerCoords_Struct
  301. {
  302. uint32_t _owner;
  303. uint32_t length;
  304. PointerCoords_Struct* ptr;
  305. };
  306. class Array_PointerCoords_Helper
  307. {
  308. public:
  309. static void
  310. unwrap(NativeArray<MotionEventGlue::Coords>& from, Array_PointerCoords_Struct* to)
  311. {
  312. to->_owner = 0x7380548b;
  313. to->length = from.length();
  314. {
  315. to->ptr = MarshalHelper::allocArray<PointerCoords_Struct>(from.length());
  316. for(uint32_t i = 0; i < from.length(); i++)
  317. {
  318. PointerCoords_Helper::unwrap(from.item(i), &(to->ptr[i]));
  319. }
  320. }
  321. }
  322. static Array_PointerCoords_Struct*
  323. unwrap(NativeArray<MotionEventGlue::Coords>* src)
  324. {
  325. if (src == NULL)
  326. {
  327. return NULL;
  328. }
  329. Array_PointerCoords_Struct* retval = new Array_PointerCoords_Struct();
  330. Array_PointerCoords_Helper::unwrap(*src, retval);
  331. return retval;
  332. }
  333. static void
  334. marshalOut(const NativeArray<MotionEventGlue::Coords>& from, Array_PointerCoords_Struct*
  335. to)
  336. {
  337. assert(from.length() == to->length);
  338. for(uint32_t i = 0; i < from.length(); i++)
  339. {
  340. PointerCoords_Helper::marshalOut(from.item(i), &(to->ptr[i]));
  341. }
  342. }
  343. static void
  344. wrap(const Array_PointerCoords_Struct& from, NativeArray<MotionEventGlue::Coords>*
  345. to)
  346. {
  347. assert(from.length == to->length());
  348. for(uint32_t i = 0; i < from.length; i++)
  349. {
  350. PointerCoords_Helper::wrap(from.ptr[i], &(to->item(i)));
  351. }
  352. }
  353. static NativeArray<MotionEventGlue::Coords>*
  354. wrap(const Array_PointerCoords_Struct* src)
  355. {
  356. if (src == NULL)
  357. {
  358. return NULL;
  359. }
  360. NativeArray<MotionEventGlue::Coords>* retval = new NativeArray<MotionEventGlue::Coords>
  361. (src->length);
  362. Array_PointerCoords_Helper::wrap(*src, retval);
  363. return retval;
  364. }
  365. static const NativeArray<MotionEventGlue::Coords>*
  366. wrapConst(const Array_PointerCoords_Struct* src)
  367. {
  368. return const_cast<const NativeArray<MotionEventGlue::Coords>*>(Array_PointerCoords_Helper
  369. ::wrap(src));
  370. }
  371. static void
  372. freeMembers(Array_PointerCoords_Struct& obj)
  373. {
  374. assert(obj._owner == 0x7380548b);
  375. {
  376. for(uint32_t i = 0; i < obj.length; i++)
  377. {
  378. PointerCoords_Helper::freeMembers(obj.ptr[i]);
  379. }
  380. MarshalHelper::freeArray<PointerCoords_Struct>(obj.ptr, obj.length);
  381. }
  382. }
  383. static void
  384. destructor(Array_PointerCoords_Struct* obj)
  385. {
  386. if (obj == NULL)
  387. {
  388. return;
  389. }
  390. Array_PointerCoords_Helper::freeMembers(*obj);
  391. delete obj;
  392. }
  393. private:
  394. Array_PointerCoords_Helper();
  395. };
  396. extern "C" DLL_EXPORT void
  397. libxobotos_android_view_MotionEvent_Array_PointerCoords_destructor(Array_PointerCoords_Struct*
  398. obj)
  399. {
  400. Array_PointerCoords_Helper::destructor(obj);
  401. }
  402. extern "C" DLL_EXPORT int
  403. libxobotos_MotionEvent_getToolType(MotionEventGlue* nativePtr, int pointerIndex)
  404. {
  405. int _retval = nativePtr->getToolType(pointerIndex);
  406. return _retval;
  407. }
  408. extern "C" DLL_EXPORT void
  409. libxobotos_MotionEvent_offsetLocation(MotionEventGlue* nativePtr, float deltaX, float
  410. deltaY)
  411. {
  412. nativePtr->offsetLocation(deltaX, deltaY);
  413. }
  414. extern "C" DLL_EXPORT bool
  415. libxobotos_MotionEvent_isTouchEvent(MotionEventGlue* nativePtr)
  416. {
  417. bool _retval = nativePtr->isTouchEvent();
  418. return _retval;
  419. }
  420. extern "C" DLL_EXPORT int
  421. libxobotos_MotionEvent_getFlags(MotionEventGlue* nativePtr)
  422. {
  423. int _retval = nativePtr->getFlags();
  424. return _retval;
  425. }
  426. extern "C" DLL_EXPORT int
  427. libxobotos_MotionEvent_getButtonState(MotionEventGlue* nativePtr)
  428. {
  429. int _retval = nativePtr->getButtonState();
  430. return _retval;
  431. }
  432. extern "C" DLL_EXPORT float
  433. libxobotos_MotionEvent_getYOffset(MotionEventGlue* nativePtr)
  434. {
  435. float _retval = nativePtr->getYOffset();
  436. return _retval;
  437. }
  438. extern "C" DLL_EXPORT int
  439. libxobotos_MotionEvent_getMetaState(MotionEventGlue* nativePtr)
  440. {
  441. int _retval = nativePtr->getMetaState();
  442. return _retval;
  443. }
  444. extern "C" DLL_EXPORT long
  445. libxobotos_MotionEvent_getDownTime(MotionEventGlue* nativePtr)
  446. {
  447. long _retval = nativePtr->getDownTime();
  448. return _retval;
  449. }
  450. extern "C" DLL_EXPORT MotionEventGlue*
  451. libxobotos_MotionEvent_initialize(MotionEventGlue* nativePtr, int deviceId, int source,
  452. int action, int flags, int edgeFlags, int metaState, int buttonState, float xOffset,
  453. float yOffset, float xPrecision, float yPrecision, long downTimeNanos, long eventTimeNanos,
  454. int pointerCount, Array_PointerProperties_Struct* pointerIds_ptr, Array_PointerCoords_Struct*
  455. pointerCoords_ptr)
  456. {
  457. const NativeArray<MotionEventGlue::Properties>* pointerIds = Array_PointerProperties_Helper
  458. ::wrapConst(pointerIds_ptr);
  459. const NativeArray<MotionEventGlue::Coords>* pointerCoords = Array_PointerCoords_Helper
  460. ::wrapConst(pointerCoords_ptr);
  461. MotionEventGlue* _retval = MotionEventGlue::initialize(nativePtr, deviceId, source,
  462. action, flags, edgeFlags, metaState, buttonState, xOffset, yOffset, xPrecision,
  463. yPrecision, downTimeNanos, eventTimeNanos, pointerCount, *pointerIds, *pointerCoords);
  464. delete pointerIds;
  465. delete pointerCoords;
  466. return _retval;
  467. }
  468. extern "C" DLL_EXPORT int
  469. libxobotos_MotionEvent_getPointerCount(MotionEventGlue* nativePtr)
  470. {
  471. int _retval = nativePtr->getPointerCount();
  472. return _retval;
  473. }
  474. extern "C" DLL_EXPORT void
  475. libxobotos_MotionEvent_scale(MotionEventGlue* nativePtr, float scale)
  476. {
  477. nativePtr->scale(scale);
  478. }
  479. extern "C" DLL_EXPORT float
  480. libxobotos_MotionEvent_getAxisValue(MotionEventGlue* nativePtr, int axis, int pointerIndex,
  481. int historyPos)
  482. {
  483. float _retval = nativePtr->getAxisValue(axis, pointerIndex, historyPos);
  484. return _retval;
  485. }
  486. extern "C" DLL_EXPORT int
  487. libxobotos_MotionEvent_getHistorySize(MotionEventGlue* nativePtr)
  488. {
  489. int _retval = nativePtr->getHistorySize();
  490. return _retval;
  491. }
  492. extern "C" DLL_EXPORT int
  493. libxobotos_MotionEvent_getEdgeFlags(MotionEventGlue* nativePtr)
  494. {
  495. int _retval = nativePtr->getEdgeFlags();
  496. return _retval;
  497. }
  498. extern "C" DLL_EXPORT float
  499. libxobotos_MotionEvent_getXOffset(MotionEventGlue* nativePtr)
  500. {
  501. float _retval = nativePtr->getXOffset();
  502. return _retval;
  503. }
  504. extern "C" DLL_EXPORT float
  505. libxobotos_MotionEvent_getXPrecision(MotionEventGlue* nativePtr)
  506. {
  507. float _retval = nativePtr->getXPrecision();
  508. return _retval;
  509. }
  510. extern "C" DLL_EXPORT int
  511. libxobotos_MotionEvent_getSource(MotionEventGlue* nativePtr)
  512. {
  513. int _retval = nativePtr->getSource();
  514. return _retval;
  515. }
  516. extern "C" DLL_EXPORT int
  517. libxobotos_MotionEvent_getDeviceId(MotionEventGlue* nativePtr)
  518. {
  519. int _retval = nativePtr->getDeviceId();
  520. return _retval;
  521. }
  522. extern "C" DLL_EXPORT void
  523. libxobotos_MotionEvent_setFlags(MotionEventGlue* nativePtr, int flags)
  524. {
  525. nativePtr->setFlags(flags);
  526. }
  527. extern "C" DLL_EXPORT MotionEventGlue*
  528. libxobotos_MotionEvent_copy(MotionEventGlue* destNativePtr, MotionEventGlue* sourceNativePtr,
  529. bool keepHistory)
  530. {
  531. MotionEventGlue* _retval = MotionEventGlue::copy(destNativePtr, *sourceNativePtr,
  532. keepHistory);
  533. return _retval;
  534. }
  535. extern "C" DLL_EXPORT void
  536. libxobotos_MotionEvent_setEdgeFlags(MotionEventGlue* nativePtr, int action)
  537. {
  538. nativePtr->setEdgeFlags(action);
  539. }
  540. extern "C" DLL_EXPORT void
  541. libxobotos_MotionEvent_getPointerProperties(MotionEventGlue* nativePtr, int pointerIndex,
  542. PointerProperties_Struct** outPointerProperties_ptr)
  543. {
  544. MotionEventGlue::Properties outPointerProperties;
  545. nativePtr->getPointerProperties(pointerIndex, &outPointerProperties);
  546. *outPointerProperties_ptr = PointerProperties_Helper::unwrap(&outPointerProperties);
  547. }
  548. extern "C" DLL_EXPORT float
  549. libxobotos_MotionEvent_getRawAxisValue(MotionEventGlue* nativePtr, int axis, int
  550. pointerIndex, int historyPos)
  551. {
  552. float _retval = nativePtr->getRawAxisValue(axis, pointerIndex, historyPos);
  553. return _retval;
  554. }
  555. extern "C" DLL_EXPORT int
  556. libxobotos_MotionEvent_getAction(MotionEventGlue* nativePtr)
  557. {
  558. int _retval = nativePtr->getAction();
  559. return _retval;
  560. }
  561. extern "C" DLL_EXPORT float
  562. libxobotos_MotionEvent_getYPrecision(MotionEventGlue* nativePtr)
  563. {
  564. float _retval = nativePtr->getYPrecision();
  565. return _retval;
  566. }
  567. extern "C" DLL_EXPORT void
  568. libxobotos_MotionEvent_setSource(MotionEventGlue* nativePtr, int source)
  569. {
  570. nativePtr->setSource(source);
  571. }
  572. extern "C" DLL_EXPORT void
  573. libxobotos_MotionEvent_getPointerCoords(MotionEventGlue* nativePtr, int pointerIndex,
  574. int historyPos, PointerCoords_Struct** outPointerCoords_ptr)
  575. {
  576. MotionEventGlue::Coords outPointerCoords;
  577. nativePtr->getPointerCoords(pointerIndex, historyPos, &outPointerCoords);
  578. *outPointerCoords_ptr = PointerCoords_Helper::unwrap(&outPointerCoords);
  579. }
  580. extern "C" DLL_EXPORT int
  581. libxobotos_MotionEvent_getPointerId(MotionEventGlue* nativePtr, int pointerIndex)
  582. {
  583. int _retval = nativePtr->getPointerId(pointerIndex);
  584. return _retval;
  585. }
  586. extern "C" DLL_EXPORT void
  587. libxobotos_MotionEvent_setAction(MotionEventGlue* nativePtr, int action)
  588. {
  589. nativePtr->setAction(action);
  590. }
  591. extern "C" DLL_EXPORT void
  592. libxobotos_MotionEvent_addBatch(MotionEventGlue* nativePtr, long eventTimeNanos,
  593. Array_PointerCoords_Struct* pointerCoords_ptr, int metaState)
  594. {
  595. const NativeArray<MotionEventGlue::Coords>* pointerCoords = Array_PointerCoords_Helper
  596. ::wrapConst(pointerCoords_ptr);
  597. nativePtr->addBatch(eventTimeNanos, *pointerCoords, metaState);
  598. delete pointerCoords;
  599. }
  600. extern "C" DLL_EXPORT long
  601. libxobotos_MotionEvent_getEventTimeNanos(MotionEventGlue* nativePtr, int historyPos)
  602. {
  603. long _retval = nativePtr->getEventTimeNanos(historyPos);
  604. return _retval;
  605. }
  606. extern "C" DLL_EXPORT int
  607. libxobotos_MotionEvent_findPointerIndex(MotionEventGlue* nativePtr, int pointerId)
  608. {
  609. int _retval = nativePtr->findPointerIndex(pointerId);
  610. return _retval;
  611. }
  612. extern "C" DLL_EXPORT void
  613. libxobotos_MotionEvent_setDownTime(MotionEventGlue* nativePtr, long downTime)
  614. {
  615. nativePtr->setDownTime(downTime);
  616. }