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.

128 lines
4.0KB

  1. /*
  2. * DISTRHO Plugin Framework (DPF)
  3. * Copyright (C) 2012-2022 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.h in their C++ friendly form, then pugl stuff in custom namespace */
  20. #include <cstddef>
  21. #ifdef DISTRHO_PROPER_CPP11_SUPPORT
  22. # include <cstdbool>
  23. # include <cstdint>
  24. #else
  25. # include <stdbool.h>
  26. # include <stdint.h>
  27. #endif
  28. // hidden api
  29. #define PUGL_API
  30. #define PUGL_DISABLE_DEPRECATED
  31. #define PUGL_NO_INCLUDE_GL_H
  32. #define PUGL_NO_INCLUDE_GLU_H
  33. // do not set extern "C"
  34. // #define __cplusplus_backup __cplusplus
  35. // #undef __cplusplus
  36. // give warning if defined as something else
  37. // #define PUGL_BEGIN_DECLS
  38. // #define PUGL_END_DECLS
  39. // --------------------------------------------------------------------------------------------------------------------
  40. START_NAMESPACE_DGL
  41. #include "pugl-upstream/include/pugl/pugl.h"
  42. // DGL specific, expose backend enter
  43. bool puglBackendEnter(PuglView* view);
  44. // DGL specific, expose backend leave
  45. bool puglBackendLeave(PuglView* view);
  46. // DGL specific, assigns backend that matches current DGL build
  47. void puglSetMatchingBackendForCurrentBuild(PuglView* view);
  48. // clear minimum size to 0
  49. void puglClearMinSize(PuglView* view);
  50. // bring view window into the foreground, aka "raise" window
  51. void puglRaiseWindow(PuglView* view);
  52. // get scale factor from parent window if possible, fallback to puglGetScaleFactor
  53. double puglGetScaleFactorFromParent(const PuglView* view);
  54. // combined puglSetSizeHint using PUGL_MIN_SIZE, PUGL_MIN_ASPECT and PUGL_MAX_ASPECT
  55. PuglStatus puglSetGeometryConstraints(PuglView* view, uint width, uint height, bool aspect);
  56. // set view as resizable (or not) during runtime
  57. void puglSetResizable(PuglView* view, bool resizable);
  58. // set window size while also changing default
  59. PuglStatus puglSetSizeAndDefault(PuglView* view, uint width, uint height);
  60. // DGL specific, build-specific drawing prepare
  61. void puglOnDisplayPrepare(PuglView* view);
  62. // DGL specific, build-specific fallback resize
  63. void puglFallbackOnResize(PuglView* view);
  64. #if defined(DISTRHO_OS_MAC)
  65. // macOS specific, allow standalone window to gain focus
  66. PUGL_API void
  67. puglMacOSActivateApp();
  68. // macOS specific, add another view's window as child
  69. PUGL_API PuglStatus
  70. puglMacOSAddChildWindow(PuglView* view, PuglView* child);
  71. // macOS specific, remove another view's window as child
  72. PUGL_API PuglStatus
  73. puglMacOSRemoveChildWindow(PuglView* view, PuglView* child);
  74. // macOS specific, center view based on parent coordinates (if there is one)
  75. PUGL_API void
  76. puglMacOSShowCentered(PuglView* view);
  77. #elif defined(DISTRHO_OS_WINDOWS)
  78. // win32 specific, call ShowWindow with SW_RESTORE
  79. PUGL_API void
  80. puglWin32RestoreWindow(PuglView* view);
  81. // win32 specific, center view based on parent coordinates (if there is one)
  82. PUGL_API void
  83. puglWin32ShowCentered(PuglView* view);
  84. #elif defined(HAVE_X11)
  85. // X11 specific, set dialog window type and pid hints
  86. void puglX11SetWindowTypeAndPID(const PuglView* view, bool isStandalone);
  87. #endif
  88. // --------------------------------------------------------------------------------------------------------------------
  89. END_NAMESPACE_DGL
  90. // #define __cplusplus __cplusplus_backup
  91. // #undef __cplusplus_backup
  92. #endif // DGL_PUGL_HPP_INCLUDED