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.

108 lines
1.4KB

  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. 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. int button;
  21. Widget *target = NULL;
  22. };
  23. struct EventMouseMove : EventPosition {
  24. Vec mouseRel;
  25. Widget *target = NULL;
  26. };
  27. struct EventHoverKey : EventPosition {
  28. int key;
  29. Widget *target = NULL;
  30. };
  31. struct EventMouseEnter : Event {
  32. };
  33. struct EventMouseLeave : Event {
  34. };
  35. struct EventFocus : Event {
  36. };
  37. struct EventDefocus : Event {
  38. };
  39. struct EventText : Event {
  40. int codepoint;
  41. };
  42. struct EventKey : Event {
  43. int key;
  44. };
  45. struct EventScroll : EventPosition {
  46. Vec scrollRel;
  47. };
  48. /////////////
  49. struct EventDragStart : Event {
  50. };
  51. struct EventDragEnd : Event {
  52. };
  53. struct EventDragMove : Event {
  54. Vec mouseRel;
  55. };
  56. struct EventDragEnter : Event {
  57. Widget *origin = NULL;
  58. };
  59. struct EventDragLeave : Event {
  60. Widget *origin = NULL;
  61. };
  62. struct EventDragDrop : Event {
  63. Widget *origin = NULL;
  64. };
  65. struct EventPathDrop : EventPosition {
  66. std::list<std::string> paths;
  67. };
  68. struct EventAction : Event {
  69. };
  70. struct EventChange : Event {
  71. };
  72. struct EventZoom : Event {
  73. };
  74. } // namespace rack