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.

lv2_external_ui.h 3.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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 when UI (GUI window) is closed by user.
  62. * This callback will be called during execution of LV2_External_UI_Widget::run()
  63. * (i.e. not from background thread).
  64. *
  65. * After this callback is called, UI is defunct. Host must call LV2UI_Descriptor::cleanup().
  66. * If host wants to make the UI visible again, the UI must be reinstantiated.
  67. *
  68. * @note When using the depreated URI LV2_EXTERNAL_UI_DEPRECATED_URI,
  69. * some hosts will not call LV2UI_Descriptor::cleanup() as they should,
  70. * and may call show() again without re-initialization.
  71. *
  72. * @param controller Host context associated with plugin UI, as
  73. * supplied to LV2UI_Descriptor::instantiate().
  74. */
  75. void (*ui_closed)(LV2UI_Controller controller);
  76. /**
  77. * Optional (may be NULL) "user friendly" identifier which the UI
  78. * may display to allow a user to easily associate this particular
  79. * UI instance with the correct plugin instance as it is represented
  80. * by the host (e.g. "track 1" or "channel 4").
  81. *
  82. * If supplied by host, the string will be referenced only during
  83. * LV2UI_Descriptor::instantiate()
  84. */
  85. const char * plugin_human_id;
  86. } LV2_External_UI_Host;
  87. #ifdef __cplusplus
  88. } /* extern "C" */
  89. #endif
  90. #endif /* LV2_EXTERNAL_UI_H */