KXStudio Website https://kx.studio/
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
3.2KB

  1. /*
  2. LV2 External UI extension
  3. This work is in public domain.
  4. This file is distributed in the hope that it will be useful,
  5. but WITHOUT ANY WARRANTY; without even the implied warranty of
  6. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  7. If you have questions, contact Filipe Coelho (aka falkTX) <falktx@falktx.com>
  8. or ask in #lad channel, FreeNode IRC network.
  9. */
  10. /**
  11. @file lv2_external_ui.h
  12. C header for the LV2 External UI extension <http://kxstudio.sf.net/ns/lv2ext/external-ui>.
  13. */
  14. #ifndef LV2_EXTERNAL_UI_H
  15. #define LV2_EXTERNAL_UI_H
  16. #include "lv2/lv2plug.in/ns/extensions/ui/ui.h"
  17. #define LV2_EXTERNAL_UI_URI "http://kxstudio.sf.net/ns/lv2ext/external-ui"
  18. #define LV2_EXTERNAL_UI_PREFIX LV2_EXTERNAL_UI_URI "#"
  19. #define LV2_EXTERNAL_UI__Host LV2_EXTERNAL_UI_PREFIX "Host"
  20. #define LV2_EXTERNAL_UI__Widget LV2_EXTERNAL_UI_PREFIX "Widget"
  21. /** This extension used to be defined by a lv2plug.in URI */
  22. #define LV2_EXTERNAL_UI_DEPRECATED_URI "http://lv2plug.in/ns/extensions/ui#external"
  23. #ifdef __cplusplus
  24. extern "C" {
  25. #endif
  26. /**
  27. * When LV2_EXTERNAL_UI__Widget UI is instantiated, the returned
  28. * LV2UI_Widget handle must be cast to pointer to LV2_External_UI_Widget.
  29. * UI is created in invisible state.
  30. */
  31. typedef struct _LV2_External_UI_Widget {
  32. /**
  33. * Host calls this function regulary. UI library implementing the
  34. * callback may do IPC or redraw the UI.
  35. *
  36. * @param _this_ the UI context
  37. */
  38. void (*run)(struct _LV2_External_UI_Widget * _this_);
  39. /**
  40. * Host calls this function to make the plugin UI visible.
  41. *
  42. * @param _this_ the UI context
  43. */
  44. void (*show)(struct _LV2_External_UI_Widget * _this_);
  45. /**
  46. * Host calls this function to make the plugin UI invisible again.
  47. *
  48. * @param _this_ the UI context
  49. */
  50. void (*hide)(struct _LV2_External_UI_Widget * _this_);
  51. } LV2_External_UI_Widget;
  52. #define LV2_EXTERNAL_UI_RUN(ptr) (ptr)->run(ptr)
  53. #define LV2_EXTERNAL_UI_SHOW(ptr) (ptr)->show(ptr)
  54. #define LV2_EXTERNAL_UI_HIDE(ptr) (ptr)->hide(ptr)
  55. /**
  56. * On UI instantiation, host must supply LV2_EXTERNAL_UI__Host feature.
  57. * LV2_Feature::data must be pointer to LV2_External_UI_Host.
  58. */
  59. typedef struct _LV2_External_UI_Host {
  60. /**
  61. * Callback that plugin UI will call
  62. * when UI (GUI window) is closed by user.
  63. * This callback will be called during execution of LV2_External_UI_Widget::run()
  64. * (i.e. not from background thread).
  65. *
  66. * After this callback is called, UI is defunct. Host must call
  67. * LV2UI_Descriptor::cleanup(). If host wants to make the UI visible
  68. * again UI must be reinstantiated.
  69. *
  70. * @param controller Host context associated with plugin UI, as
  71. * supplied to LV2UI_Descriptor::instantiate()
  72. */
  73. void (*ui_closed)(LV2UI_Controller controller);
  74. /**
  75. * Optional (may be NULL) "user friendly" identifier which the UI
  76. * may display to allow a user to easily associate this particular
  77. * UI instance with the correct plugin instance as it is represented
  78. * by the host (e.g. "track 1" or "channel 4").
  79. *
  80. * If supplied by host, the string will be referenced only during
  81. * LV2UI_Descriptor::instantiate()
  82. */
  83. const char * plugin_human_id;
  84. } LV2_External_UI_Host;
  85. #ifdef __cplusplus
  86. } /* extern "C" */
  87. #endif
  88. #endif /* LV2_EXTERNAL_UI_H */