Audio plugin host https://kx.studio/carla
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.

CarlaPluginUI.hpp 2.5KB

10 years ago
10 years ago
10 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /*
  2. * Carla Plugin UI
  3. * Copyright (C) 2014-2022 Filipe Coelho <falktx@falktx.com>
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License as
  7. * published by the Free Software Foundation; either version 2 of
  8. * the License, or any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * For a full copy of the GNU General Public License see the doc/GPL.txt file.
  16. */
  17. #ifndef CARLA_PLUGIN_UI_HPP_INCLUDED
  18. #define CARLA_PLUGIN_UI_HPP_INCLUDED
  19. #include "CarlaUtils.hpp"
  20. // -----------------------------------------------------
  21. class CarlaPluginUI
  22. {
  23. public:
  24. class Callback {
  25. public:
  26. virtual ~Callback() {}
  27. virtual void handlePluginUIClosed() = 0;
  28. virtual void handlePluginUIResized(uint width, uint height) = 0;
  29. };
  30. virtual ~CarlaPluginUI() {}
  31. virtual void show() = 0;
  32. virtual void hide() = 0;
  33. virtual void focus() = 0;
  34. virtual void idle() = 0;
  35. virtual void setSize(uint with, uint height, bool forceUpdate) = 0;
  36. virtual void setTitle(const char* title) = 0;
  37. virtual void setChildWindow(void* ptr) = 0;
  38. virtual void setTransientWinId(uintptr_t winId) = 0;
  39. virtual void* getPtr() const noexcept = 0;
  40. #ifdef HAVE_X11
  41. virtual void* getDisplay() const noexcept = 0;
  42. #endif
  43. #ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH
  44. static bool tryTransientWinIdMatch(uintptr_t pid, const char* uiTitle, uintptr_t winId, bool centerUI);
  45. #endif
  46. #ifdef CARLA_OS_MAC
  47. static CarlaPluginUI* newCocoa(Callback*, uintptr_t, bool isStandalone, bool isResizable);
  48. #endif
  49. #ifdef CARLA_OS_WIN
  50. static CarlaPluginUI* newWindows(Callback*, uintptr_t, bool isStandalone, bool isResizable);
  51. #endif
  52. #ifdef HAVE_X11
  53. static CarlaPluginUI* newX11(Callback*, uintptr_t, bool isStandalone, bool isResizable, bool canMonitorChildren);
  54. #endif
  55. protected:
  56. bool fIsIdling;
  57. bool fIsStandalone;
  58. bool fIsResizable;
  59. Callback* fCallback;
  60. CarlaPluginUI(Callback* const cb,
  61. const bool isStandalone,
  62. const bool isResizable) noexcept
  63. : fIsIdling(false),
  64. fIsStandalone(isStandalone),
  65. fIsResizable(isResizable),
  66. fCallback(cb) {}
  67. CARLA_DECLARE_NON_COPYABLE(CarlaPluginUI)
  68. };
  69. // -----------------------------------------------------
  70. #endif // CARLA_PLUGIN_UI_HPP_INCLUDED