MouseEvent.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. #ifndef MouseEreignis_H
  2. #define MouseEreignis_H
  3. #include <functional>
  4. #include "Vec3.h"
  5. namespace Framework
  6. {
  7. const int M_Left = 0;
  8. const int M_Middle = 1;
  9. const int M_Right = 2;
  10. const int ME_PLeft = 0;
  11. const int ME_PRight = 1;
  12. const int ME_PMiddle = 2;
  13. const int ME_RLeft = 3;
  14. const int ME_RRight = 4;
  15. const int ME_RMiddle = 5;
  16. const int ME_DCLeft = 6;
  17. const int ME_DCRight = 7;
  18. const int ME_DCMiddle = 8;
  19. const int ME_Enter = 9;
  20. const int ME_Leaves = 10;
  21. const int ME_Move = 11;
  22. const int ME_UScroll = 12;
  23. const int ME_DScroll = 13;
  24. const int ME_RScroll = 14;
  25. const int ME_LScroll = 15;
  26. //! Stores a specific mouse input from the user
  27. struct MouseEvent
  28. {
  29. //! Type of input
  30. int id;
  31. //! X coordinate on screen relative to the drawing position
  32. int mx;
  33. //! Y coordinate on screen relative to the drawing position
  34. int my;
  35. //! Stores whether the input has already been processed
  36. bool processed;
  37. //! Stores whether the mouse event is inside the object
  38. //! that contains this object
  39. bool insideParent;
  40. //! original X coordinate
  41. int originalX;
  42. //! original Y coordinate
  43. int originalY;
  44. };
  45. //! Stores a specific mouse input from the user in 3D
  46. struct MouseEvent3D
  47. {
  48. //! Type of input
  49. int id;
  50. //! The position of the mouse in the world
  51. Vec3<float> pos;
  52. //! The direction the camera is pointing
  53. Vec3<float> dir;
  54. //! Stores whether the input has already been processed
  55. bool processed;
  56. };
  57. typedef std::function<bool(void*, void*, MouseEvent)> MouseAction;
  58. //! Default mouse event callback function
  59. //! \param param An arbitrary parameter
  60. //! \param obj The drawing that calls this function
  61. //! \param te The mouse event to process
  62. //! \return (true) if the calling drawing should continue processing
  63. //! the event. (false) otherwise. Always returns (true)
  64. DLLEXPORT bool _ret1ME(void* param, void* obj, MouseEvent me);
  65. //! Default mouse event callback function
  66. //! \param param An arbitrary parameter
  67. //! \param obj The drawing that calls this function
  68. //! \param te The mouse event to process
  69. //! \return (true) if the calling drawing should continue processing
  70. //! the event. (false) otherwise. Always returns (true) and closes the
  71. //! window that called it (may only be set on windows)
  72. DLLEXPORT bool _closeWindowME(void* param, void* obj, MouseEvent me);
  73. } // namespace Framework
  74. #endif