/src/org/mt4j/input/inputProcessors/MTGestureEvent.java

http://mt4j.googlecode.com/ · Java · 109 lines · 27 code · 24 blank · 58 comment · 0 complexity · 5fd7a7feb4954732ae71267fe86ebea5 MD5 · raw file

  1. /***********************************************************************
  2. * mt4j Copyright (c) 2008 - 2009, C.Ruff, Fraunhofer-Gesellschaft All rights reserved.
  3. *
  4. * This program is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation, either version 3 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. *
  17. ***********************************************************************/
  18. package org.mt4j.input.inputProcessors;
  19. import org.mt4j.components.interfaces.IMTComponent3D;
  20. import org.mt4j.input.inputData.MTInputEvent;
  21. /**
  22. * The Class GestureEvent.
  23. * @author Christopher Ruff
  24. */
  25. public abstract class MTGestureEvent extends MTInputEvent {
  26. /** The id. */
  27. private int id;
  28. /**
  29. The Constant GESTURE_DETECTED.
  30. @deprecated use GESTURE_STARTED instead */
  31. public static final int GESTURE_DETECTED = 0;
  32. /** The Constant GESTURE_STARTED. */
  33. public static final int GESTURE_STARTED = 0;
  34. /** The Constant GESTURE_UPDATED. */
  35. public static final int GESTURE_UPDATED = 1;
  36. /** The Constant GESTURE_ENDED. */
  37. public static final int GESTURE_ENDED = 2;
  38. /** The Constant GESTURE_CANCELED.
  39. * Used when the gesture/input processing is aborted.
  40. * It is not guaranteed atm that GESTURE_ENDED will be called in the future.
  41. * */
  42. public static final int GESTURE_CANCELED = 3;
  43. /** The Constant GESTURE_RESUMED.
  44. * Used when a gesture is resumed because it has the highest priority again for example.
  45. * */
  46. public static final int GESTURE_RESUMED = 4;
  47. /**
  48. * Instantiates a new gesture event.
  49. *
  50. * @param source the source
  51. * @param id the id
  52. * @param targetComponent the target component
  53. */
  54. public MTGestureEvent(IInputProcessor source, int id, IMTComponent3D targetComponent) {
  55. super(source, targetComponent, false);
  56. this.id = id;
  57. this.setCurrentTarget(targetComponent); //test ..
  58. }
  59. @Override
  60. public IInputProcessor getSource() {
  61. return (IInputProcessor)super.getSource();
  62. }
  63. /**
  64. * Gets the id.
  65. * <br>Can be a value of:
  66. * <ul>
  67. * <li>GESTURE_DETECTED
  68. * <li>GESTURE_UPDATED
  69. * <li>GESTURE_ENDED
  70. * </ul>
  71. *
  72. * @return the id
  73. */
  74. public int getId() {
  75. return id;
  76. }
  77. /**
  78. * Sets the id.
  79. *
  80. * @param id the new id
  81. */
  82. public void setId(int id) {
  83. this.id = id;
  84. }
  85. }