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.

Application.hpp 2.5KB

8 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /*
  2. * DISTRHO Plugin Framework (DPF)
  3. * Copyright (C) 2012-2016 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_APP_HPP_INCLUDED
  17. #define DGL_APP_HPP_INCLUDED
  18. #include "Base.hpp"
  19. START_NAMESPACE_DGL
  20. // -----------------------------------------------------------------------
  21. // Forward class names
  22. class Window;
  23. // -----------------------------------------------------------------------
  24. /**
  25. Base DGL Application class.
  26. One application instance is required for creating a window.
  27. There's no single/global application instance in DGL, and multiple
  28. windows can share the same app instance.
  29. In standalone mode an application will automatically quit its
  30. event-loop when all its windows are closed.
  31. */
  32. class Application
  33. {
  34. public:
  35. /**
  36. Constructor.
  37. */
  38. Application();
  39. /**
  40. Destructor.
  41. */
  42. virtual ~Application();
  43. /**
  44. Idle function.
  45. This runs the application event-loop once.
  46. */
  47. void idle();
  48. /**
  49. Run the application event-loop until all Windows are closed.
  50. idle() is called at regular intervals.
  51. @note This function is meant for standalones only, *never* call this from plugins.
  52. */
  53. void exec();
  54. /**
  55. Quit the application.
  56. This stops the event-loop and closes all Windows.
  57. */
  58. void quit();
  59. /**
  60. Check if the application is about to quit.
  61. Returning true means there's no event-loop running at the moment (or it's just about to stop).
  62. */
  63. bool isQuiting() const noexcept;
  64. private:
  65. struct PrivateData;
  66. PrivateData* const pData;
  67. friend class Window;
  68. DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(Application)
  69. };
  70. // -----------------------------------------------------------------------
  71. END_NAMESPACE_DGL
  72. #endif // DGL_APP_HPP_INCLUDED