DISTRHO Plugin Framework
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.

92 lines
3.1KB

  1. /*
  2. * DISTRHO Plugin Framework (DPF)
  3. * Copyright (C) 2012-2024 Filipe Coelho <falktx@falktx.com>
  4. *
  5. * Permission to use, copy, modify, and/or distribute this software for any purpose with
  6. * or without fee is hereby granted, provided that the above copyright notice and this
  7. * permission notice appear in all copies.
  8. *
  9. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
  10. * TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN
  11. * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  12. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
  13. * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
  14. * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  15. */
  16. #if !defined(DISTRHO_WEB_VIEW_HPP_INCLUDED) && !defined(DGL_WEB_VIEW_HPP_INCLUDED)
  17. # error bad include
  18. #endif
  19. // --------------------------------------------------------------------------------------------------------------------
  20. // Web View stuff
  21. struct WebViewData;
  22. typedef WebViewData* WebViewHandle;
  23. // --------------------------------------------------------------------------------------------------------------------
  24. /**
  25. Web view options, for customizing web view details.
  26. */
  27. struct WebViewOptions {
  28. /**
  29. Position offset, for cases of mixing regular widgets with web views.
  30. */
  31. struct PositionOffset {
  32. /** Horizontal offset */
  33. int x;
  34. /** Vertical offset */
  35. int y;
  36. /** Constructor for default values */
  37. PositionOffset() : x(0), y(0) {}
  38. } offset;
  39. /** Constructor for default values */
  40. WebViewOptions()
  41. : offset() {}
  42. };
  43. // --------------------------------------------------------------------------------------------------------------------
  44. /**
  45. Create a new web view.
  46. The web view will be added on top of an existing platform-specific view/window.
  47. This means it will draw on top of whatever is below it,
  48. something to take into consideration if mixing regular widgets with web views.
  49. @p windowId: The native window id to attach this view to (X11 Window, HWND or NSView*)
  50. @p scaleFactor: Scale factor to use (only used on X11)
  51. @p options: Extra options, optional
  52. */
  53. WebViewHandle webViewCreate(uintptr_t windowId,
  54. uint initialWidth,
  55. uint initialHeight,
  56. double scaleFactor,
  57. const WebViewOptions& options = WebViewOptions());
  58. /**
  59. Destroy the web view, handle must not be used afterwards.
  60. */
  61. void webViewDestroy(WebViewHandle webview);
  62. /**
  63. Evaluate/run JavaScript on the web view.
  64. */
  65. void webViewEvaluateJS(WebViewHandle webview, const char* js);
  66. /**
  67. Reload the web view current page.
  68. */
  69. void webViewReload(WebViewHandle webview);
  70. /**
  71. Resize the web view.
  72. */
  73. void webViewResize(WebViewHandle webview, uint width, uint height, double scaleFactor);
  74. // --------------------------------------------------------------------------------------------------------------------