The JUCE cross-platform C++ framework, with DISTRHO/KXStudio specific changes
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.

153 lines
5.9KB

  1. /*
  2. ==============================================================================
  3. This file is part of the juce_core module of the JUCE library.
  4. Copyright (c) 2013 - Raw Material Software Ltd.
  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. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
  9. TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN
  10. NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  11. DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
  12. IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
  13. CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  14. ------------------------------------------------------------------------------
  15. NOTE! This permissive ISC license applies ONLY to files within the juce_core module!
  16. All other JUCE modules are covered by a dual GPL/commercial license, so if you are
  17. using any other modules, be sure to check that you also comply with their license.
  18. For more details, visit www.juce.com
  19. ==============================================================================
  20. */
  21. #ifndef __JUCE_PROCESS_JUCEHEADER__
  22. #define __JUCE_PROCESS_JUCEHEADER__
  23. #include "../text/juce_String.h"
  24. //==============================================================================
  25. /** Represents the current executable's process.
  26. This contains methods for controlling the current application at the
  27. process-level.
  28. @see Thread, JUCEApplication
  29. */
  30. class JUCE_API Process
  31. {
  32. public:
  33. //==============================================================================
  34. enum ProcessPriority
  35. {
  36. LowPriority = 0,
  37. NormalPriority = 1,
  38. HighPriority = 2,
  39. RealtimePriority = 3
  40. };
  41. /** Changes the current process's priority.
  42. @param priority the process priority, where
  43. 0=low, 1=normal, 2=high, 3=realtime
  44. */
  45. static void setPriority (const ProcessPriority priority);
  46. /** Kills the current process immediately.
  47. This is an emergency process terminator that kills the application
  48. immediately - it's intended only for use only when something goes
  49. horribly wrong.
  50. @see JUCEApplication::quit
  51. */
  52. static void terminate();
  53. //==============================================================================
  54. /** Returns true if this application process is the one that the user is
  55. currently using.
  56. */
  57. static bool isForegroundProcess();
  58. /** Attempts to make the current process the active one.
  59. (This is not possible on some platforms).
  60. */
  61. static void makeForegroundProcess();
  62. //==============================================================================
  63. /** Raises the current process's privilege level.
  64. Does nothing if this isn't supported by the current OS, or if process
  65. privilege level is fixed.
  66. */
  67. static void raisePrivilege();
  68. /** Lowers the current process's privilege level.
  69. Does nothing if this isn't supported by the current OS, or if process
  70. privilege level is fixed.
  71. */
  72. static void lowerPrivilege();
  73. //==============================================================================
  74. /** Returns true if this process is being hosted by a debugger. */
  75. static bool JUCE_CALLTYPE isRunningUnderDebugger();
  76. //==============================================================================
  77. /** Tries to launch the OS's default reader application for a given file or URL. */
  78. static bool openDocument (const String& documentURL, const String& parameters);
  79. /** Tries to launch the OS's default email application to let the user create a message. */
  80. static bool openEmailWithAttachments (const String& targetEmailAddress,
  81. const String& emailSubject,
  82. const String& bodyText,
  83. const StringArray& filesToAttach);
  84. #if JUCE_WINDOWS || DOXYGEN
  85. //==============================================================================
  86. /** WINDOWS ONLY - This returns the HINSTANCE of the current module.
  87. The return type is a void* to avoid being dependent on windows.h - just cast
  88. it to a HINSTANCE to use it.
  89. In a normal JUCE application, this will be automatically set to the module
  90. handle of the executable.
  91. If you've built a DLL and plan to use any JUCE messaging or windowing classes,
  92. you'll need to make sure you call the setCurrentModuleInstanceHandle()
  93. to provide the correct module handle in your DllMain() function, because
  94. the system relies on the correct instance handle when opening windows.
  95. */
  96. static void* JUCE_CALLTYPE getCurrentModuleInstanceHandle() noexcept;
  97. /** WINDOWS ONLY - Sets a new module handle to be used by the library.
  98. The parameter type is a void* to avoid being dependent on windows.h, but it actually
  99. expects a HINSTANCE value.
  100. @see getCurrentModuleInstanceHandle()
  101. */
  102. static void JUCE_CALLTYPE setCurrentModuleInstanceHandle (void* newHandle) noexcept;
  103. #endif
  104. #if JUCE_MAC || DOXYGEN
  105. //==============================================================================
  106. /** OSX ONLY - Shows or hides the OSX dock icon for this app. */
  107. static void setDockIconVisible (bool isVisible);
  108. #endif
  109. private:
  110. Process();
  111. JUCE_DECLARE_NON_COPYABLE (Process)
  112. };
  113. #endif // __JUCE_PROCESS_JUCEHEADER__