Event.js 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. function Event() {
  2. if(arguments[0] != "__skip_ptr__") {
  3. this.__ptr = Polycode.Event()
  4. }
  5. Object.defineProperties(this, {
  6. 'deleteOnDispatch': { enumerable: true, configurable: true, get: Event.prototype.__get_deleteOnDispatch, set: Event.prototype.__set_deleteOnDispatch},
  7. 'cancelEventFlag': { enumerable: true, configurable: true, get: Event.prototype.__get_cancelEventFlag, set: Event.prototype.__set_cancelEventFlag}
  8. })
  9. }
  10. Event.EVENTBASE_EVENT = 0x100
  11. Event.COMPLETE_EVENT = EVENTBASE_EVENT + 0
  12. Event.CHANGE_EVENT = EVENTBASE_EVENT + 1
  13. Event.CANCEL_EVENT = EVENTBASE_EVENT + 2
  14. Event.NOTIFY_EVENT = EVENTBASE_EVENT + 3
  15. Event.FIRE_EVENT = EVENTBASE_EVENT + 4
  16. Event.RESOURCE_RELOAD_EVENT = EVENTBASE_EVENT + 5
  17. Event.SELECT_EVENT = EVENTBASE_EVENT + 6
  18. Event.REMOVE_EVENT = EVENTBASE_EVENT + 7
  19. Event.RESOURCE_CHANGE_EVENT = EVENTBASE_EVENT + 8
  20. Event.RESOURCE_DESTROY_EVENT = EVENTBASE_EVENT + 9
  21. Event.EVENTBASE_NONPOLYCODE = 0x10000
  22. Event.prototype.__get_deleteOnDispatch = function() {
  23. return Polycode.Event__get_deleteOnDispatch(this.__ptr)
  24. }
  25. Event.prototype.__set_deleteOnDispatch = function(val) {
  26. Polycode.Event__set_deleteOnDispatch(this.__ptr, val)
  27. }
  28. Event.prototype.__get_cancelEventFlag = function() {
  29. return Polycode.Event__get_cancelEventFlag(this.__ptr)
  30. }
  31. Event.prototype.__set_cancelEventFlag = function(val) {
  32. Polycode.Event__set_cancelEventFlag(this.__ptr, val)
  33. }
  34. Duktape.fin(Event.prototype, function (x) {
  35. if (x === Event.prototype) {
  36. return;
  37. }
  38. Polycode.Event__delete(x.__ptr)
  39. })
  40. Event.prototype.getEventCode = function() {
  41. return Polycode.Event_getEventCode(this.__ptr)
  42. }
  43. Event.prototype.setEventCode = function(eventCode) {
  44. Polycode.Event_setEventCode(this.__ptr, eventCode)
  45. }
  46. Event.prototype.getEventType = function() {
  47. return Polycode.Event_getEventType(this.__ptr)
  48. }
  49. Event.prototype.cancelEvent = function() {
  50. Polycode.Event_cancelEvent(this.__ptr)
  51. }