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.

140 lines
4.2KB

  1. /*
  2. * DISTRHO Plugin Framework (DPF)
  3. * Copyright (C) 2012-2021 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. #ifndef DGL_PUGL_HPP_INCLUDED
  17. #define DGL_PUGL_HPP_INCLUDED
  18. #include "../Base.hpp"
  19. /* we will include all header files used in pugl in their C++ friendly form, then pugl stuff in custom namespace */
  20. #include <cstdbool>
  21. #include <cstddef>
  22. #include <cstdint>
  23. #define PUGL_API
  24. #define PUGL_DISABLE_DEPRECATED
  25. #define PUGL_NO_INCLUDE_GLU_H
  26. // --------------------------------------------------------------------------------------------------------------------
  27. #ifndef DISTRHO_OS_MAC
  28. START_NAMESPACE_DGL
  29. #else
  30. USE_NAMESPACE_DGL
  31. #endif
  32. #include "pugl-upstream/include/pugl/pugl.h"
  33. // --------------------------------------------------------------------------------------------------------------------
  34. PUGL_BEGIN_DECLS
  35. // expose backend enter
  36. PUGL_API void
  37. puglBackendEnter(PuglView* view);
  38. // expose backend leave
  39. PUGL_API void
  40. puglBackendLeave(PuglView* view);
  41. // clear minimum size to 0
  42. PUGL_API void
  43. puglClearMinSize(PuglView* view);
  44. // missing in pugl, directly returns transient parent
  45. PUGL_API PuglNativeView
  46. puglGetTransientParent(const PuglView* view);
  47. // missing in pugl, directly returns title char* pointer
  48. PUGL_API const char*
  49. puglGetWindowTitle(const PuglView* view);
  50. // bring view window into the foreground, aka "raise" window
  51. PUGL_API void
  52. puglRaiseWindow(PuglView* view);
  53. // DGL specific, assigns backend that matches current DGL build
  54. PUGL_API void
  55. puglSetMatchingBackendForCurrentBuild(PuglView* view);
  56. // Combine puglSetMinSize and puglSetAspectRatio
  57. PUGL_API PuglStatus
  58. puglSetGeometryConstraints(PuglView* view, unsigned int width, unsigned int height, bool aspect);
  59. // set window size with default size and without changing frame x/y position
  60. PUGL_API PuglStatus
  61. puglSetWindowSize(PuglView* view, unsigned int width, unsigned int height);
  62. // DGL specific, build-specific drawing prepare
  63. PUGL_API void
  64. puglOnDisplayPrepare(PuglView* view);
  65. // DGL specific, build-specific fallback resize
  66. PUGL_API void
  67. puglFallbackOnResize(PuglView* view);
  68. #ifdef DISTRHO_OS_MAC
  69. // macOS specific, setup file browser dialog
  70. typedef void (*openPanelCallback)(PuglView* view, const char* path);
  71. bool puglMacOSFilePanelOpen(PuglView* view, const char* startDir, const char* title, uint flags, openPanelCallback callback);
  72. #endif
  73. #ifdef DISTRHO_OS_WINDOWS
  74. // win32 specific, call ShowWindow with SW_RESTORE
  75. PUGL_API void
  76. puglWin32RestoreWindow(PuglView* view);
  77. // win32 specific, center view based on parent coordinates (if there is one)
  78. PUGL_API void
  79. puglWin32ShowWindowCentered(PuglView* view);
  80. // win32 specific, set or unset WS_SIZEBOX style flag
  81. PUGL_API void
  82. puglWin32SetWindowResizable(PuglView* view, bool resizable);
  83. #endif
  84. #ifdef HAVE_X11
  85. // X11 specific, setup event loop filter for sofd file dialog
  86. PUGL_API void
  87. sofdFileDialogSetup(PuglWorld* world);
  88. // X11 specific, show file dialog via sofd
  89. PUGL_API bool
  90. sofdFileDialogShow(PuglView* view, const char* startDir, const char* title, uint flags, uint width, uint height);
  91. // X11 specific, close sofd file dialog
  92. PUGL_API void
  93. sofdFileDialogClose(PuglView* view);
  94. // X11 specific, get path chosen via sofd file dialog
  95. PUGL_API bool
  96. sofdFileDialogGetPath(char** path);
  97. // X11 specific, free path of sofd file dialog, no longer needed
  98. PUGL_API void
  99. sofdFileDialogFree(char* path);
  100. #endif
  101. PUGL_END_DECLS
  102. // --------------------------------------------------------------------------------------------------------------------
  103. #ifndef DISTRHO_OS_MAC
  104. END_NAMESPACE_DGL
  105. #endif
  106. #endif // DGL_PUGL_HPP_INCLUDED