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.

83 lines
1.9KB

  1. /*
  2. * Carla Plugin
  3. * Copyright (C) 2011-2013 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 GPL.txt file
  16. */
  17. #ifndef __CARLA_PLUGIN_GUI_HPP__
  18. #define __CARLA_PLUGIN_GUI_HPP__
  19. #include "CarlaPluginInternal.hpp"
  20. #include <QtGui/QCloseEvent>
  21. # if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
  22. # include <QtWidgets/QMainWindow>
  23. #else
  24. # include <QtGui/QMainWindow>
  25. #endif
  26. CARLA_BACKEND_START_NAMESPACE
  27. class CarlaPluginGui : public QMainWindow
  28. {
  29. Q_OBJECT
  30. public:
  31. class Callback
  32. {
  33. public:
  34. virtual ~Callback() {}
  35. virtual void guiClosedCallback() = 0;
  36. };
  37. struct Options {
  38. bool parented;
  39. bool resizable;
  40. };
  41. CarlaPluginGui(CarlaEngine* const engine, Callback* const callback, const Options& options);
  42. ~CarlaPluginGui();
  43. void setSize(const int width, const int height);
  44. // Parent UIs
  45. void* getContainerWinId();
  46. // Qt UIs
  47. void setWidget(QWidget* widget);
  48. protected:
  49. void closeEvent(QCloseEvent* const event);
  50. private:
  51. Callback* const kCallback;
  52. QWidget* fContainer;
  53. const Options fOptions;
  54. signals:
  55. void setSizeSafeSignal(int, int);
  56. private slots:
  57. void setSizeSafeSlot(int width, int height);
  58. #ifndef MOC_PARSING
  59. CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(CarlaPluginGui)
  60. #endif
  61. };
  62. CARLA_BACKEND_END_NAMESPACE
  63. #endif // __CARLA_PLUGIN_GUI_HPP__