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.

354 lines
13KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2020 - 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 6 End-User License
  8. Agreement and JUCE Privacy Policy (both effective as of the 16th June 2020).
  9. End User License Agreement: www.juce.com/juce-6-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. //==============================================================================
  37. #if JUCE_MAC
  38. #import <WebKit/WebKit.h>
  39. #import <IOKit/pwr_mgt/IOPMLib.h>
  40. #if JUCE_SUPPORT_CARBON
  41. #import <Carbon/Carbon.h> // still needed for SetSystemUIMode()
  42. #endif
  43. #elif JUCE_IOS
  44. #if JUCE_PUSH_NOTIFICATIONS && defined (__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0
  45. #import <UserNotifications/UserNotifications.h>
  46. #endif
  47. #import <UIKit/UIActivityViewController.h>
  48. //==============================================================================
  49. #elif JUCE_WINDOWS
  50. #include <windowsx.h>
  51. #include <vfw.h>
  52. #include <commdlg.h>
  53. #if ! JUCE_MINGW
  54. #include <UIAutomation.h>
  55. #include <sapi.h>
  56. #endif
  57. #if JUCE_WEB_BROWSER
  58. #include <exdisp.h>
  59. #include <exdispid.h>
  60. #endif
  61. #if JUCE_MINGW
  62. #include <imm.h>
  63. #elif ! JUCE_DONT_AUTOLINK_TO_WIN32_LIBRARIES
  64. #pragma comment(lib, "vfw32.lib")
  65. #pragma comment(lib, "imm32.lib")
  66. #if JUCE_OPENGL
  67. #pragma comment(lib, "OpenGL32.Lib")
  68. #pragma comment(lib, "GlU32.Lib")
  69. #endif
  70. #if JUCE_DIRECT2D
  71. #pragma comment (lib, "Dwrite.lib")
  72. #pragma comment (lib, "D2d1.lib")
  73. #endif
  74. #endif
  75. #endif
  76. #include <set>
  77. //==============================================================================
  78. #define JUCE_ASSERT_MESSAGE_MANAGER_IS_LOCKED_OR_OFFSCREEN \
  79. jassert ((MessageManager::getInstanceWithoutCreating() != nullptr \
  80. && MessageManager::getInstanceWithoutCreating()->currentThreadHasLockedMessageManager()) \
  81. || getPeer() == nullptr);
  82. namespace juce
  83. {
  84. bool juce_areThereAnyAlwaysOnTopWindows();
  85. bool isEmbeddedInForegroundProcess (Component* c);
  86. #if ! JUCE_WINDOWS
  87. bool isEmbeddedInForegroundProcess (Component*) { return false; }
  88. #endif
  89. /* Returns true if this process is in the foreground, or if the viewComponent
  90. is embedded into a window owned by the foreground process.
  91. */
  92. bool isForegroundOrEmbeddedProcess (Component* viewComponent)
  93. {
  94. return Process::isForegroundProcess() || isEmbeddedInForegroundProcess (viewComponent);
  95. }
  96. }
  97. #include "accessibility/juce_AccessibilityHandler.cpp"
  98. #include "components/juce_Component.cpp"
  99. #include "components/juce_ComponentListener.cpp"
  100. #include "components/juce_FocusTraverser.cpp"
  101. #include "mouse/juce_MouseInputSource.cpp"
  102. #include "desktop/juce_Displays.cpp"
  103. #include "desktop/juce_Desktop.cpp"
  104. #include "components/juce_ModalComponentManager.cpp"
  105. #include "mouse/juce_ComponentDragger.cpp"
  106. #include "mouse/juce_DragAndDropContainer.cpp"
  107. #include "mouse/juce_MouseCursor.cpp"
  108. #include "mouse/juce_MouseEvent.cpp"
  109. #include "mouse/juce_MouseInactivityDetector.cpp"
  110. #include "mouse/juce_MouseListener.cpp"
  111. #include "keyboard/juce_CaretComponent.cpp"
  112. #include "keyboard/juce_KeyboardFocusTraverser.cpp"
  113. #include "keyboard/juce_KeyListener.cpp"
  114. #include "keyboard/juce_KeyPress.cpp"
  115. #include "keyboard/juce_ModifierKeys.cpp"
  116. #include "buttons/juce_ArrowButton.cpp"
  117. #include "buttons/juce_Button.cpp"
  118. #include "buttons/juce_DrawableButton.cpp"
  119. #include "buttons/juce_HyperlinkButton.cpp"
  120. #include "buttons/juce_ImageButton.cpp"
  121. #include "buttons/juce_ShapeButton.cpp"
  122. #include "buttons/juce_TextButton.cpp"
  123. #include "buttons/juce_ToggleButton.cpp"
  124. #include "buttons/juce_ToolbarButton.cpp"
  125. #include "drawables/juce_Drawable.cpp"
  126. #include "drawables/juce_DrawableComposite.cpp"
  127. #include "drawables/juce_DrawableImage.cpp"
  128. #include "drawables/juce_DrawablePath.cpp"
  129. #include "drawables/juce_DrawableRectangle.cpp"
  130. #include "drawables/juce_DrawableShape.cpp"
  131. #include "drawables/juce_DrawableText.cpp"
  132. #include "drawables/juce_SVGParser.cpp"
  133. #include "filebrowser/juce_DirectoryContentsDisplayComponent.cpp"
  134. #include "filebrowser/juce_DirectoryContentsList.cpp"
  135. #include "filebrowser/juce_FileBrowserComponent.cpp"
  136. #include "filebrowser/juce_FileChooser.cpp"
  137. #include "filebrowser/juce_FileChooserDialogBox.cpp"
  138. #include "filebrowser/juce_FileListComponent.cpp"
  139. #include "filebrowser/juce_FilenameComponent.cpp"
  140. #include "filebrowser/juce_FileSearchPathListComponent.cpp"
  141. #include "filebrowser/juce_FileTreeComponent.cpp"
  142. #include "filebrowser/juce_ImagePreviewComponent.cpp"
  143. #include "filebrowser/juce_ContentSharer.cpp"
  144. #include "layout/juce_ComponentAnimator.cpp"
  145. #include "layout/juce_ComponentBoundsConstrainer.cpp"
  146. #include "layout/juce_ComponentBuilder.cpp"
  147. #include "layout/juce_ComponentMovementWatcher.cpp"
  148. #include "layout/juce_ConcertinaPanel.cpp"
  149. #include "layout/juce_GroupComponent.cpp"
  150. #include "layout/juce_MultiDocumentPanel.cpp"
  151. #include "layout/juce_ResizableBorderComponent.cpp"
  152. #include "layout/juce_ResizableCornerComponent.cpp"
  153. #include "layout/juce_ResizableEdgeComponent.cpp"
  154. #include "layout/juce_ScrollBar.cpp"
  155. #include "layout/juce_SidePanel.cpp"
  156. #include "layout/juce_StretchableLayoutManager.cpp"
  157. #include "layout/juce_StretchableLayoutResizerBar.cpp"
  158. #include "layout/juce_StretchableObjectResizer.cpp"
  159. #include "layout/juce_TabbedButtonBar.cpp"
  160. #include "layout/juce_TabbedComponent.cpp"
  161. #include "layout/juce_Viewport.cpp"
  162. #include "lookandfeel/juce_LookAndFeel.cpp"
  163. #include "lookandfeel/juce_LookAndFeel_V2.cpp"
  164. #include "lookandfeel/juce_LookAndFeel_V1.cpp"
  165. #include "lookandfeel/juce_LookAndFeel_V3.cpp"
  166. #include "lookandfeel/juce_LookAndFeel_V4.cpp"
  167. #include "menus/juce_MenuBarComponent.cpp"
  168. #include "menus/juce_BurgerMenuComponent.cpp"
  169. #include "menus/juce_MenuBarModel.cpp"
  170. #include "menus/juce_PopupMenu.cpp"
  171. #include "positioning/juce_MarkerList.cpp"
  172. #include "positioning/juce_RelativeCoordinate.cpp"
  173. #include "positioning/juce_RelativeCoordinatePositioner.cpp"
  174. #include "positioning/juce_RelativeParallelogram.cpp"
  175. #include "positioning/juce_RelativePoint.cpp"
  176. #include "positioning/juce_RelativePointPath.cpp"
  177. #include "positioning/juce_RelativeRectangle.cpp"
  178. #include "properties/juce_BooleanPropertyComponent.cpp"
  179. #include "properties/juce_ButtonPropertyComponent.cpp"
  180. #include "properties/juce_ChoicePropertyComponent.cpp"
  181. #include "properties/juce_PropertyComponent.cpp"
  182. #include "properties/juce_PropertyPanel.cpp"
  183. #include "properties/juce_SliderPropertyComponent.cpp"
  184. #include "properties/juce_TextPropertyComponent.cpp"
  185. #include "properties/juce_MultiChoicePropertyComponent.cpp"
  186. #include "widgets/juce_ComboBox.cpp"
  187. #include "widgets/juce_ImageComponent.cpp"
  188. #include "widgets/juce_Label.cpp"
  189. #include "widgets/juce_ListBox.cpp"
  190. #include "widgets/juce_ProgressBar.cpp"
  191. #include "widgets/juce_Slider.cpp"
  192. #include "widgets/juce_TableHeaderComponent.cpp"
  193. #include "widgets/juce_TableListBox.cpp"
  194. #include "widgets/juce_TextEditor.cpp"
  195. #include "widgets/juce_ToolbarItemComponent.cpp"
  196. #include "widgets/juce_Toolbar.cpp"
  197. #include "widgets/juce_ToolbarItemPalette.cpp"
  198. #include "widgets/juce_TreeView.cpp"
  199. #include "windows/juce_AlertWindow.cpp"
  200. #include "windows/juce_CallOutBox.cpp"
  201. #include "windows/juce_ComponentPeer.cpp"
  202. #include "windows/juce_DialogWindow.cpp"
  203. #include "windows/juce_DocumentWindow.cpp"
  204. #include "windows/juce_ResizableWindow.cpp"
  205. #include "windows/juce_ThreadWithProgressWindow.cpp"
  206. #include "windows/juce_TooltipWindow.cpp"
  207. #include "windows/juce_TopLevelWindow.cpp"
  208. #include "commands/juce_ApplicationCommandInfo.cpp"
  209. #include "commands/juce_ApplicationCommandManager.cpp"
  210. #include "commands/juce_ApplicationCommandTarget.cpp"
  211. #include "commands/juce_KeyPressMappingSet.cpp"
  212. #include "application/juce_Application.cpp"
  213. #include "misc/juce_BubbleComponent.cpp"
  214. #include "misc/juce_DropShadower.cpp"
  215. #include "misc/juce_JUCESplashScreen.cpp"
  216. #include "layout/juce_FlexBox.cpp"
  217. #include "layout/juce_GridItem.cpp"
  218. #include "layout/juce_Grid.cpp"
  219. #if JUCE_IOS || JUCE_WINDOWS
  220. #include "native/juce_MultiTouchMapper.h"
  221. #endif
  222. namespace juce
  223. {
  224. static const juce::Identifier disableAsyncLayerBackedViewIdentifier { "disableAsyncLayerBackedView" };
  225. /** Used by the macOS and iOS peers. */
  226. void setComponentAsyncLayerBackedViewDisabled (juce::Component& comp, bool shouldDisableAsyncLayerBackedView)
  227. {
  228. comp.getProperties().set (disableAsyncLayerBackedViewIdentifier, shouldDisableAsyncLayerBackedView);
  229. }
  230. /** Used by the macOS and iOS peers. */
  231. bool getComponentAsyncLayerBackedViewDisabled (juce::Component& comp)
  232. {
  233. return comp.getProperties()[disableAsyncLayerBackedViewIdentifier];
  234. }
  235. } // namespace juce
  236. #if JUCE_MAC || JUCE_IOS
  237. #if JUCE_IOS
  238. #include "native/juce_ios_UIViewComponentPeer.mm"
  239. #include "native/juce_ios_Windowing.mm"
  240. #include "native/juce_ios_FileChooser.mm"
  241. #if JUCE_CONTENT_SHARING
  242. #include "native/juce_ios_ContentSharer.cpp"
  243. #endif
  244. #else
  245. #include "native/accessibility/juce_mac_Accessibility.mm"
  246. #include "native/juce_mac_NSViewComponentPeer.mm"
  247. #include "native/juce_mac_Windowing.mm"
  248. #include "native/juce_mac_MainMenu.mm"
  249. #include "native/juce_mac_FileChooser.mm"
  250. #endif
  251. #include "native/juce_mac_MouseCursor.mm"
  252. #elif JUCE_WINDOWS
  253. #if ! JUCE_MINGW
  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. #else
  261. namespace juce
  262. {
  263. namespace WindowsAccessibility
  264. {
  265. long getUiaRootObjectId() { return -1; }
  266. bool handleWmGetObject (AccessibilityHandler*, WPARAM, LPARAM, LRESULT*) { return false; }
  267. void revokeUIAMapEntriesForWindow (HWND) {}
  268. }
  269. }
  270. #endif
  271. #include "native/juce_win32_Windowing.cpp"
  272. #include "native/juce_win32_DragAndDrop.cpp"
  273. #include "native/juce_win32_FileChooser.cpp"
  274. #elif JUCE_LINUX || JUCE_BSD
  275. #include "native/x11/juce_linux_X11_Symbols.cpp"
  276. #include "native/x11/juce_linux_X11_DragAndDrop.cpp"
  277. JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wzero-as-null-pointer-constant")
  278. #include "native/juce_linux_Windowing.cpp"
  279. #include "native/x11/juce_linux_XWindowSystem.cpp"
  280. JUCE_END_IGNORE_WARNINGS_GCC_LIKE
  281. #include "native/juce_linux_FileChooser.cpp"
  282. #elif JUCE_ANDROID
  283. #include "native/juce_android_Windowing.cpp"
  284. #include "native/juce_common_MimeTypes.cpp"
  285. #include "native/juce_android_FileChooser.cpp"
  286. #if JUCE_CONTENT_SHARING
  287. #include "native/juce_android_ContentSharer.cpp"
  288. #endif
  289. #endif
  290. #if ! JUCE_NATIVE_ACCESSIBILITY_INCLUDED
  291. namespace juce
  292. {
  293. class AccessibilityHandler::AccessibilityNativeImpl { public: AccessibilityNativeImpl (AccessibilityHandler&) {} };
  294. void AccessibilityHandler::notifyAccessibilityEvent (AccessibilityEvent) const {}
  295. void AccessibilityHandler::postAnnouncement (const String&, AnnouncementPriority) {}
  296. AccessibilityNativeHandle* AccessibilityHandler::getNativeImplementation() const { return nullptr; }
  297. AccessibilityHandler::AccessibilityNativeImpl* AccessibilityHandler::createNativeImpl (AccessibilityHandler&) { return nullptr; }
  298. void AccessibilityHandler::DestroyNativeImpl::operator() (AccessibilityHandler::AccessibilityNativeImpl*) const noexcept {}
  299. bool areAnyAccessibilityClientsActive() { return false; }
  300. void notifyAccessibilityEventInternal (const AccessibilityHandler&, InternalAccessibilityEvent) {}
  301. }
  302. #endif