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.

419 lines
15KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2022 - Raw Material Software Limited
  5. JUCE is an open source library subject to commercial or open-source
  6. licensing.
  7. By using JUCE, you agree to the terms of both the JUCE 7 End-User License
  8. Agreement and JUCE Privacy Policy.
  9. End User License Agreement: www.juce.com/juce-7-licence
  10. Privacy Policy: www.juce.com/juce-privacy-policy
  11. Or: You may also use this code under the terms of the GPL v3 (see
  12. www.gnu.org/licenses).
  13. JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
  14. EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
  15. DISCLAIMED.
  16. ==============================================================================
  17. */
  18. #ifdef JUCE_GUI_BASICS_H_INCLUDED
  19. /* When you add this cpp file to your project, you mustn't include it in a file where you've
  20. already included any other headers - just put it inside a file on its own, possibly with your config
  21. flags preceding it, but don't include anything else. That also includes avoiding any automatic prefix
  22. header files that the compiler may be using.
  23. */
  24. #error "Incorrect use of JUCE cpp file"
  25. #endif
  26. #define NS_FORMAT_FUNCTION(F,A) // To avoid spurious warnings from GCC
  27. #define JUCE_CORE_INCLUDE_OBJC_HELPERS 1
  28. #define JUCE_CORE_INCLUDE_COM_SMART_PTR 1
  29. #define JUCE_CORE_INCLUDE_JNI_HELPERS 1
  30. #define JUCE_CORE_INCLUDE_NATIVE_HEADERS 1
  31. #define JUCE_EVENTS_INCLUDE_WIN32_MESSAGE_WINDOW 1
  32. #define JUCE_GRAPHICS_INCLUDE_COREGRAPHICS_HELPERS 1
  33. #define JUCE_GUI_BASICS_INCLUDE_XHEADERS 1
  34. #define JUCE_GUI_BASICS_INCLUDE_SCOPED_THREAD_DPI_AWARENESS_SETTER 1
  35. #include "juce_gui_basics.h"
  36. #include <cctype>
  37. //==============================================================================
  38. #if JUCE_MAC
  39. #import <WebKit/WebKit.h>
  40. #import <IOKit/pwr_mgt/IOPMLib.h>
  41. #elif JUCE_IOS
  42. #if JUCE_PUSH_NOTIFICATIONS && defined (__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0
  43. #import <UserNotifications/UserNotifications.h>
  44. #endif
  45. #import <MetalKit/MetalKit.h>
  46. #import <UIKit/UIActivityViewController.h>
  47. //==============================================================================
  48. #elif JUCE_WINDOWS
  49. #include <windowsx.h>
  50. #include <vfw.h>
  51. #include <commdlg.h>
  52. #include <commctrl.h>
  53. #include <sapi.h>
  54. #if JUCE_MSVC
  55. #include <Dxgi.h>
  56. #include <UIAutomation.h>
  57. #endif
  58. #if JUCE_WEB_BROWSER
  59. #include <exdisp.h>
  60. #include <exdispid.h>
  61. #endif
  62. #if JUCE_MINGW
  63. #include <imm.h>
  64. #elif ! JUCE_DONT_AUTOLINK_TO_WIN32_LIBRARIES
  65. #pragma comment(lib, "vfw32.lib")
  66. #pragma comment(lib, "imm32.lib")
  67. #pragma comment(lib, "comctl32.lib")
  68. #pragma comment(lib, "dxgi.lib")
  69. #if JUCE_OPENGL
  70. #pragma comment(lib, "OpenGL32.Lib")
  71. #pragma comment(lib, "GlU32.Lib")
  72. #endif
  73. #if JUCE_DIRECT2D
  74. #pragma comment (lib, "Dwrite.lib")
  75. #pragma comment (lib, "D2d1.lib")
  76. #endif
  77. #endif
  78. #endif
  79. //==============================================================================
  80. #define JUCE_ASSERT_MESSAGE_MANAGER_IS_LOCKED_OR_OFFSCREEN \
  81. jassert ((MessageManager::getInstanceWithoutCreating() != nullptr \
  82. && MessageManager::getInstanceWithoutCreating()->currentThreadHasLockedMessageManager()) \
  83. || getPeer() == nullptr);
  84. namespace juce
  85. {
  86. bool juce_areThereAnyAlwaysOnTopWindows();
  87. bool isEmbeddedInForegroundProcess (Component* c);
  88. #if ! JUCE_WINDOWS
  89. bool isEmbeddedInForegroundProcess (Component*) { return false; }
  90. #endif
  91. /* Returns true if this process is in the foreground, or if the viewComponent
  92. is embedded into a window owned by the foreground process.
  93. */
  94. static bool isForegroundOrEmbeddedProcess (Component* viewComponent)
  95. {
  96. return Process::isForegroundProcess() || isEmbeddedInForegroundProcess (viewComponent);
  97. }
  98. bool isWindowOnCurrentVirtualDesktop (void*);
  99. struct CustomMouseCursorInfo
  100. {
  101. ScaledImage image;
  102. Point<int> hotspot;
  103. };
  104. } // namespace juce
  105. #include "mouse/juce_PointerState.h"
  106. #include "accessibility/juce_AccessibilityHandler.cpp"
  107. #include "components/juce_Component.cpp"
  108. #include "components/juce_ComponentListener.cpp"
  109. #include "components/juce_FocusTraverser.cpp"
  110. #include "mouse/juce_MouseInputSource.cpp"
  111. #include "desktop/juce_Displays.cpp"
  112. #include "desktop/juce_Desktop.cpp"
  113. #include "components/juce_ModalComponentManager.cpp"
  114. #include "mouse/juce_ComponentDragger.cpp"
  115. #include "mouse/juce_DragAndDropContainer.cpp"
  116. #include "mouse/juce_MouseEvent.cpp"
  117. #include "mouse/juce_MouseInactivityDetector.cpp"
  118. #include "mouse/juce_MouseListener.cpp"
  119. #include "keyboard/juce_CaretComponent.cpp"
  120. #include "keyboard/juce_KeyboardFocusTraverser.cpp"
  121. #include "keyboard/juce_KeyListener.cpp"
  122. #include "keyboard/juce_KeyPress.cpp"
  123. #include "keyboard/juce_ModifierKeys.cpp"
  124. #include "buttons/juce_ArrowButton.cpp"
  125. #include "buttons/juce_Button.cpp"
  126. #include "buttons/juce_DrawableButton.cpp"
  127. #include "buttons/juce_HyperlinkButton.cpp"
  128. #include "buttons/juce_ImageButton.cpp"
  129. #include "buttons/juce_ShapeButton.cpp"
  130. #include "buttons/juce_TextButton.cpp"
  131. #include "buttons/juce_ToggleButton.cpp"
  132. #include "buttons/juce_ToolbarButton.cpp"
  133. #include "drawables/juce_Drawable.cpp"
  134. #include "drawables/juce_DrawableComposite.cpp"
  135. #include "drawables/juce_DrawableImage.cpp"
  136. #include "drawables/juce_DrawablePath.cpp"
  137. #include "drawables/juce_DrawableRectangle.cpp"
  138. #include "drawables/juce_DrawableShape.cpp"
  139. #include "drawables/juce_DrawableText.cpp"
  140. #include "drawables/juce_SVGParser.cpp"
  141. #include "filebrowser/juce_DirectoryContentsDisplayComponent.cpp"
  142. #include "filebrowser/juce_DirectoryContentsList.cpp"
  143. #include "filebrowser/juce_FileBrowserComponent.cpp"
  144. #include "filebrowser/juce_FileChooser.cpp"
  145. #include "filebrowser/juce_FileChooserDialogBox.cpp"
  146. #include "filebrowser/juce_FileListComponent.cpp"
  147. #include "filebrowser/juce_FilenameComponent.cpp"
  148. #include "filebrowser/juce_FileSearchPathListComponent.cpp"
  149. #include "filebrowser/juce_FileTreeComponent.cpp"
  150. #include "filebrowser/juce_ImagePreviewComponent.cpp"
  151. #include "filebrowser/juce_ContentSharer.cpp"
  152. #include "layout/juce_ComponentAnimator.cpp"
  153. #include "layout/juce_ComponentBoundsConstrainer.cpp"
  154. #include "layout/juce_ComponentBuilder.cpp"
  155. #include "layout/juce_ComponentMovementWatcher.cpp"
  156. #include "layout/juce_ConcertinaPanel.cpp"
  157. #include "layout/juce_GroupComponent.cpp"
  158. #include "layout/juce_MultiDocumentPanel.cpp"
  159. #include "layout/juce_ResizableBorderComponent.cpp"
  160. #include "layout/juce_ResizableCornerComponent.cpp"
  161. #include "layout/juce_ResizableEdgeComponent.cpp"
  162. #include "layout/juce_ScrollBar.cpp"
  163. #include "layout/juce_SidePanel.cpp"
  164. #include "layout/juce_StretchableLayoutManager.cpp"
  165. #include "layout/juce_StretchableLayoutResizerBar.cpp"
  166. #include "layout/juce_StretchableObjectResizer.cpp"
  167. #include "layout/juce_TabbedButtonBar.cpp"
  168. #include "layout/juce_TabbedComponent.cpp"
  169. #include "layout/juce_Viewport.cpp"
  170. #include "lookandfeel/juce_LookAndFeel.cpp"
  171. #include "lookandfeel/juce_LookAndFeel_V2.cpp"
  172. #include "lookandfeel/juce_LookAndFeel_V1.cpp"
  173. #include "lookandfeel/juce_LookAndFeel_V3.cpp"
  174. #include "lookandfeel/juce_LookAndFeel_V4.cpp"
  175. #include "menus/juce_MenuBarComponent.cpp"
  176. #include "menus/juce_BurgerMenuComponent.cpp"
  177. #include "menus/juce_MenuBarModel.cpp"
  178. #include "menus/juce_PopupMenu.cpp"
  179. #include "positioning/juce_MarkerList.cpp"
  180. #include "positioning/juce_RelativeCoordinate.cpp"
  181. #include "positioning/juce_RelativeCoordinatePositioner.cpp"
  182. #include "positioning/juce_RelativeParallelogram.cpp"
  183. #include "positioning/juce_RelativePoint.cpp"
  184. #include "positioning/juce_RelativePointPath.cpp"
  185. #include "positioning/juce_RelativeRectangle.cpp"
  186. #include "properties/juce_BooleanPropertyComponent.cpp"
  187. #include "properties/juce_ButtonPropertyComponent.cpp"
  188. #include "properties/juce_ChoicePropertyComponent.cpp"
  189. #include "properties/juce_PropertyComponent.cpp"
  190. #include "properties/juce_PropertyPanel.cpp"
  191. #include "properties/juce_SliderPropertyComponent.cpp"
  192. #include "properties/juce_TextPropertyComponent.cpp"
  193. #include "properties/juce_MultiChoicePropertyComponent.cpp"
  194. #include "widgets/juce_ComboBox.cpp"
  195. #include "widgets/juce_ImageComponent.cpp"
  196. #include "widgets/juce_Label.cpp"
  197. #include "widgets/juce_ListBox.cpp"
  198. #include "widgets/juce_ProgressBar.cpp"
  199. #include "widgets/juce_Slider.cpp"
  200. #include "widgets/juce_TableHeaderComponent.cpp"
  201. #include "widgets/juce_TableListBox.cpp"
  202. #include "widgets/juce_TextEditor.cpp"
  203. #include "widgets/juce_ToolbarItemComponent.cpp"
  204. #include "widgets/juce_Toolbar.cpp"
  205. #include "widgets/juce_ToolbarItemPalette.cpp"
  206. #include "widgets/juce_TreeView.cpp"
  207. #include "windows/juce_AlertWindow.cpp"
  208. #include "windows/juce_CallOutBox.cpp"
  209. #include "windows/juce_ComponentPeer.cpp"
  210. #include "windows/juce_DialogWindow.cpp"
  211. #include "windows/juce_DocumentWindow.cpp"
  212. #include "windows/juce_ResizableWindow.cpp"
  213. #include "windows/juce_ThreadWithProgressWindow.cpp"
  214. #include "windows/juce_TooltipWindow.cpp"
  215. #include "windows/juce_TopLevelWindow.cpp"
  216. #include "commands/juce_ApplicationCommandInfo.cpp"
  217. #include "commands/juce_ApplicationCommandManager.cpp"
  218. #include "commands/juce_ApplicationCommandTarget.cpp"
  219. #include "commands/juce_KeyPressMappingSet.cpp"
  220. #include "application/juce_Application.cpp"
  221. #include "misc/juce_BubbleComponent.cpp"
  222. #include "misc/juce_DropShadower.cpp"
  223. #include "misc/juce_FocusOutline.cpp"
  224. #include "layout/juce_FlexBox.cpp"
  225. #include "layout/juce_GridItem.cpp"
  226. #include "layout/juce_Grid.cpp"
  227. #if JUCE_IOS || JUCE_WINDOWS
  228. #include "native/juce_MultiTouchMapper.h"
  229. #endif
  230. #if JUCE_ANDROID || JUCE_WINDOWS || JUCE_UNIT_TESTS
  231. #include "native/accessibility/juce_AccessibilityTextHelpers.h"
  232. #endif
  233. #if JUCE_MAC || JUCE_IOS
  234. #include "native/accessibility/juce_mac_AccessibilitySharedCode.mm"
  235. #if JUCE_IOS
  236. #include "native/accessibility/juce_ios_Accessibility.mm"
  237. #include "native/juce_ios_UIViewComponentPeer.mm"
  238. #include "native/juce_ios_Windowing.mm"
  239. #include "native/juce_ios_FileChooser.mm"
  240. #if JUCE_CONTENT_SHARING
  241. #include "native/juce_ios_ContentSharer.cpp"
  242. #endif
  243. #else
  244. #include "native/accessibility/juce_mac_Accessibility.mm"
  245. #include "native/juce_mac_NSViewComponentPeer.mm"
  246. #include "native/juce_mac_Windowing.mm"
  247. #include "native/juce_mac_MainMenu.mm"
  248. #include "native/juce_mac_FileChooser.mm"
  249. #endif
  250. #include "native/juce_mac_MouseCursor.mm"
  251. #elif JUCE_WINDOWS
  252. #if JUCE_MSVC
  253. #include "native/accessibility/juce_win32_ComInterfaces.h"
  254. #include "native/accessibility/juce_win32_WindowsUIAWrapper.h"
  255. #include "native/accessibility/juce_win32_AccessibilityElement.h"
  256. #include "native/accessibility/juce_win32_UIAHelpers.h"
  257. #include "native/accessibility/juce_win32_UIAProviders.h"
  258. #include "native/accessibility/juce_win32_AccessibilityElement.cpp"
  259. #include "native/accessibility/juce_win32_Accessibility.cpp"
  260. #endif
  261. #include "native/juce_win32_Windowing.cpp"
  262. #include "native/juce_win32_DragAndDrop.cpp"
  263. #include "native/juce_win32_FileChooser.cpp"
  264. #elif JUCE_LINUX || JUCE_BSD
  265. #include "native/x11/juce_linux_X11_Symbols.cpp"
  266. #include "native/x11/juce_linux_X11_DragAndDrop.cpp"
  267. JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wzero-as-null-pointer-constant")
  268. #include "native/juce_linux_Windowing.cpp"
  269. #include "native/x11/juce_linux_XWindowSystem.cpp"
  270. JUCE_END_IGNORE_WARNINGS_GCC_LIKE
  271. #include "native/juce_linux_FileChooser.cpp"
  272. #elif JUCE_ANDROID
  273. #include "juce_core/files/juce_common_MimeTypes.h"
  274. #include "native/accessibility/juce_android_Accessibility.cpp"
  275. #include "native/juce_android_Windowing.cpp"
  276. #include "native/juce_android_FileChooser.cpp"
  277. #if JUCE_CONTENT_SHARING
  278. #include "native/juce_android_ContentSharer.cpp"
  279. #endif
  280. #endif
  281. namespace juce
  282. {
  283. #if ! JUCE_NATIVE_ACCESSIBILITY_INCLUDED
  284. class AccessibilityHandler::AccessibilityNativeImpl { public: AccessibilityNativeImpl (AccessibilityHandler&) {} };
  285. void AccessibilityHandler::notifyAccessibilityEvent (AccessibilityEvent) const {}
  286. void AccessibilityHandler::postAnnouncement (const String&, AnnouncementPriority) {}
  287. AccessibilityNativeHandle* AccessibilityHandler::getNativeImplementation() const { return nullptr; }
  288. void notifyAccessibilityEventInternal (const AccessibilityHandler&, InternalAccessibilityEvent) {}
  289. std::unique_ptr<AccessibilityHandler::AccessibilityNativeImpl> AccessibilityHandler::createNativeImpl (AccessibilityHandler&)
  290. {
  291. return nullptr;
  292. }
  293. #else
  294. std::unique_ptr<AccessibilityHandler::AccessibilityNativeImpl> AccessibilityHandler::createNativeImpl (AccessibilityHandler& handler)
  295. {
  296. return std::make_unique<AccessibilityNativeImpl> (handler);
  297. }
  298. #endif
  299. }
  300. //==============================================================================
  301. #if JUCE_WINDOWS
  302. namespace juce
  303. {
  304. JUCE_COMCLASS (JuceIVirtualDesktopManager, "a5cd92ff-29be-454c-8d04-d82879fb3f1b") : public IUnknown
  305. {
  306. public:
  307. virtual HRESULT STDMETHODCALLTYPE IsWindowOnCurrentVirtualDesktop(
  308. __RPC__in HWND topLevelWindow,
  309. __RPC__out BOOL * onCurrentDesktop) = 0;
  310. virtual HRESULT STDMETHODCALLTYPE GetWindowDesktopId(
  311. __RPC__in HWND topLevelWindow,
  312. __RPC__out GUID * desktopId) = 0;
  313. virtual HRESULT STDMETHODCALLTYPE MoveWindowToDesktop(
  314. __RPC__in HWND topLevelWindow,
  315. __RPC__in REFGUID desktopId) = 0;
  316. };
  317. JUCE_COMCLASS (JuceVirtualDesktopManager, "aa509086-5ca9-4c25-8f95-589d3c07b48a");
  318. } // namespace juce
  319. #ifdef __CRT_UUID_DECL
  320. __CRT_UUID_DECL (juce::JuceIVirtualDesktopManager, 0xa5cd92ff, 0x29be, 0x454c, 0x8d, 0x04, 0xd8, 0x28, 0x79, 0xfb, 0x3f, 0x1b)
  321. __CRT_UUID_DECL (juce::JuceVirtualDesktopManager, 0xaa509086, 0x5ca9, 0x4c25, 0x8f, 0x95, 0x58, 0x9d, 0x3c, 0x07, 0xb4, 0x8a)
  322. #endif
  323. bool juce::isWindowOnCurrentVirtualDesktop (void* x)
  324. {
  325. if (x == nullptr)
  326. return false;
  327. static auto* desktopManager = []
  328. {
  329. JuceIVirtualDesktopManager* result = nullptr;
  330. JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wlanguage-extension-token")
  331. if (SUCCEEDED (CoCreateInstance (__uuidof (JuceVirtualDesktopManager), nullptr, CLSCTX_ALL, IID_PPV_ARGS (&result))))
  332. return result;
  333. JUCE_END_IGNORE_WARNINGS_GCC_LIKE
  334. return static_cast<JuceIVirtualDesktopManager*> (nullptr);
  335. }();
  336. BOOL current = false;
  337. if (auto* dm = desktopManager)
  338. if (SUCCEEDED (dm->IsWindowOnCurrentVirtualDesktop (static_cast<HWND> (x), &current)))
  339. return current != false;
  340. return true;
  341. }
  342. #else
  343. bool juce::isWindowOnCurrentVirtualDesktop (void*) { return true; }
  344. juce::ScopedDPIAwarenessDisabler::ScopedDPIAwarenessDisabler() { ignoreUnused (previousContext); }
  345. juce::ScopedDPIAwarenessDisabler::~ScopedDPIAwarenessDisabler() {}
  346. #endif
  347. // Depends on types defined in platform-specific windowing files
  348. #include "mouse/juce_MouseCursor.cpp"
  349. #if JUCE_UNIT_TESTS
  350. #include "native/accessibility/juce_AccessibilityTextHelpers_test.cpp"
  351. #endif