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.

115 lines
3.7KB

  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. #ifndef DISTRHO_OS_MAC
  34. START_NAMESPACE_DGL
  35. #endif
  36. #include "pugl-upstream/include/pugl/pugl.h"
  37. // --------------------------------------------------------------------------------------------------------------------
  38. // DGL specific, expose backend enter
  39. bool puglBackendEnter(PuglView* view);
  40. // DGL specific, expose backend leave
  41. bool puglBackendLeave(PuglView* view);
  42. // DGL specific, assigns backend that matches current DGL build
  43. void puglSetMatchingBackendForCurrentBuild(PuglView* view);
  44. // clear minimum size to 0
  45. void puglClearMinSize(PuglView* view);
  46. // bring view window into the foreground, aka "raise" window
  47. void puglRaiseWindow(PuglView* view);
  48. // get scale factor from parent window if possible, fallback to puglGetScaleFactor
  49. double puglGetScaleFactorFromParent(const PuglView* view);
  50. // combined puglSetSizeHint using PUGL_MIN_SIZE, PUGL_MIN_ASPECT and PUGL_MAX_ASPECT
  51. PuglStatus puglSetGeometryConstraints(PuglView* view, uint width, uint height, bool aspect);
  52. // set view as resizable (or not) during runtime
  53. void puglSetResizable(PuglView* view, bool resizable);
  54. // set window size while also changing default
  55. PuglStatus puglSetSizeAndDefault(PuglView* view, uint width, uint height);
  56. // DGL specific, build-specific drawing prepare
  57. void puglOnDisplayPrepare(PuglView* view);
  58. // DGL specific, build-specific fallback resize
  59. void puglFallbackOnResize(PuglView* view);
  60. #if defined(DISTRHO_OS_MAC)
  61. // macOS specific, allow standalone window to gain focus
  62. void puglMacOSActivateApp();
  63. // macOS specific, add another view's window as child
  64. PuglStatus puglMacOSAddChildWindow(PuglView* view, PuglView* child);
  65. // macOS specific, remove another view's window as child
  66. PuglStatus puglMacOSRemoveChildWindow(PuglView* view, PuglView* child);
  67. // macOS specific, center view based on parent coordinates (if there is one)
  68. void puglMacOSShowCentered(PuglView* view);
  69. #elif defined(DISTRHO_OS_WINDOWS)
  70. // win32 specific, call ShowWindow with SW_RESTORE
  71. void puglWin32RestoreWindow(PuglView* view);
  72. // win32 specific, center view based on parent coordinates (if there is one)
  73. void puglWin32ShowCentered(PuglView* view);
  74. #elif defined(HAVE_X11)
  75. // X11 specific, set dialog window type and pid hints
  76. void puglX11SetWindowTypeAndPID(const PuglView* view, bool isStandalone);
  77. #endif
  78. // --------------------------------------------------------------------------------------------------------------------
  79. #ifndef DISTRHO_OS_MAC
  80. END_NAMESPACE_DGL
  81. #endif
  82. #endif // DGL_PUGL_HPP_INCLUDED