Event.js 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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.EVENTBASE_NONPOLYCODE = 0x10000
  21. Event.prototype.__get_deleteOnDispatch = function() {
  22. return Polycode.Event__get_deleteOnDispatch(this.__ptr)
  23. }
  24. Event.prototype.__set_deleteOnDispatch = function(val) {
  25. Polycode.Event__set_deleteOnDispatch(this.__ptr, val)
  26. }
  27. Event.prototype.__get_cancelEventFlag = function() {
  28. return Polycode.Event__get_cancelEventFlag(this.__ptr)
  29. }
  30. Event.prototype.__set_cancelEventFlag = function(val) {
  31. Polycode.Event__set_cancelEventFlag(this.__ptr, val)
  32. }
  33. Duktape.fin(Event.prototype, function (x) {
  34. if (x === Event.prototype) {
  35. return;
  36. }
  37. Polycode.Event__delete(x.__ptr)
  38. })
  39. Event.prototype.getEventCode = function() {
  40. return Polycode.Event_getEventCode(this.__ptr)
  41. }
  42. Event.prototype.getDispatcher = function() {
  43. var retVal = new EventDispatcher()
  44. retVal.__ptr = Polycode.Event_getDispatcher(this.__ptr)
  45. return retVal
  46. }
  47. Event.prototype.setEventCode = function(eventCode) {
  48. Polycode.Event_setEventCode(this.__ptr, eventCode)
  49. }
  50. Event.prototype.setDispatcher = function(dispatcher) {
  51. Polycode.Event_setDispatcher(this.__ptr, dispatcher.__ptr)
  52. }
  53. Event.prototype.getEventType = function() {
  54. return Polycode.Event_getEventType(this.__ptr)
  55. }
  56. Event.prototype.cancelEvent = function() {
  57. Polycode.Event_cancelEvent(this.__ptr)
  58. }