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.6KB

10 years ago
10 years ago
10 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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 setMinimumSize(uint with, uint height) = 0;
  36. virtual void setSize(uint with, uint height, bool forceUpdate, bool resizeChild) = 0;
  37. virtual void setTitle(const char* title) = 0;
  38. virtual void setChildWindow(void* ptr) = 0;
  39. virtual void setTransientWinId(uintptr_t winId) = 0;
  40. virtual void* getPtr() const noexcept = 0;
  41. #ifdef HAVE_X11
  42. virtual void* getDisplay() const noexcept = 0;
  43. #endif
  44. #ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH
  45. static bool tryTransientWinIdMatch(uintptr_t pid, const char* uiTitle, uintptr_t winId, bool centerUI);
  46. #endif
  47. #ifdef CARLA_OS_MAC
  48. static CarlaPluginUI* newCocoa(Callback*, uintptr_t, bool isStandalone, bool isResizable);
  49. #endif
  50. #ifdef CARLA_OS_WIN
  51. static CarlaPluginUI* newWindows(Callback*, uintptr_t, bool isStandalone, bool isResizable);
  52. #endif
  53. #ifdef HAVE_X11
  54. static CarlaPluginUI* newX11(Callback*, uintptr_t, bool isStandalone, bool isResizable, bool canMonitorChildren);
  55. #endif
  56. protected:
  57. bool fIsIdling;
  58. bool fIsStandalone;
  59. bool fIsResizable;
  60. Callback* fCallback;
  61. CarlaPluginUI(Callback* const cb,
  62. const bool isStandalone,
  63. const bool isResizable) noexcept
  64. : fIsIdling(false),
  65. fIsStandalone(isStandalone),
  66. fIsResizable(isResizable),
  67. fCallback(cb) {}
  68. CARLA_DECLARE_NON_COPYABLE(CarlaPluginUI)
  69. };
  70. // -----------------------------------------------------
  71. #endif // CARLA_PLUGIN_UI_HPP_INCLUDED