You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

events.hpp 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. #pragma once
  2. #include <list>
  3. #include "math.hpp"
  4. namespace rack {
  5. struct Widget;
  6. struct Event {
  7. /** Set this to true to signal that no other widgets should receive the event */
  8. bool consumed = false;
  9. };
  10. struct EventPosition : Event {
  11. math::Vec pos;
  12. };
  13. ///////////
  14. struct EventMouseDown : EventPosition {
  15. int button;
  16. /** The widget which responded to the click. Set it to `this` if consumed. */
  17. Widget *target = NULL;
  18. };
  19. struct EventMouseUp : EventPosition {
  20. /** 0 for left mouse button, 1 for right, 2 for middle */
  21. int button;
  22. Widget *target = NULL;
  23. };
  24. struct EventMouseMove : EventPosition {
  25. math::Vec mouseRel;
  26. Widget *target = NULL;
  27. };
  28. struct EventHoverKey : EventPosition {
  29. int key;
  30. Widget *target = NULL;
  31. };
  32. struct EventMouseEnter : Event {
  33. };
  34. struct EventMouseLeave : Event {
  35. };
  36. struct EventFocus : Event {
  37. };
  38. struct EventDefocus : Event {
  39. };
  40. struct EventText : Event {
  41. int codepoint;
  42. };
  43. struct EventKey : Event {
  44. int key;
  45. };
  46. struct EventScroll : EventPosition {
  47. math::Vec scrollRel;
  48. };
  49. /////////////
  50. struct EventDragStart : Event {
  51. };
  52. struct EventDragEnd : Event {
  53. };
  54. struct EventDragMove : Event {
  55. math::Vec mouseRel;
  56. };
  57. struct EventDragEnter : Event {
  58. Widget *origin = NULL;
  59. };
  60. struct EventDragLeave : Event {
  61. Widget *origin = NULL;
  62. };
  63. struct EventDragDrop : Event {
  64. Widget *origin = NULL;
  65. };
  66. struct EventPathDrop : EventPosition {
  67. std::list<std::string> paths;
  68. };
  69. struct EventAction : Event {
  70. };
  71. struct EventChange : Event {
  72. };
  73. struct EventZoom : Event {
  74. };
  75. } // namespace rack