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.

juce_gui_basics.cpp 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315
  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2017 - ROLI Ltd.
  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 5 End-User License
  8. Agreement and JUCE 5 Privacy Policy (both updated and effective as of the
  9. 27th April 2017).
  10. End User License Agreement: www.juce.com/juce-5-licence
  11. Privacy Policy: www.juce.com/juce-5-privacy-policy
  12. Or: You may also use this code under the terms of the GPL v3 (see
  13. www.gnu.org/licenses).
  14. JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
  15. EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
  16. DISCLAIMED.
  17. ==============================================================================
  18. */
  19. #ifdef JUCE_GUI_BASICS_H_INCLUDED
  20. /* When you add this cpp file to your project, you mustn't include it in a file where you've
  21. already included any other headers - just put it inside a file on its own, possibly with your config
  22. flags preceding it, but don't include anything else. That also includes avoiding any automatic prefix
  23. header files that the compiler may be using.
  24. */
  25. #error "Incorrect use of JUCE cpp file"
  26. #endif
  27. #include "AppConfig.h"
  28. #define NS_FORMAT_FUNCTION(F,A) // To avoid spurious warnings from GCC
  29. #define JUCE_CORE_INCLUDE_OBJC_HELPERS 1
  30. #define JUCE_CORE_INCLUDE_COM_SMART_PTR 1
  31. #define JUCE_CORE_INCLUDE_JNI_HELPERS 1
  32. #define JUCE_CORE_INCLUDE_NATIVE_HEADERS 1
  33. #define JUCE_EVENTS_INCLUDE_WIN32_MESSAGE_WINDOW 1
  34. #define JUCE_GRAPHICS_INCLUDE_COREGRAPHICS_HELPERS 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. //==============================================================================
  44. #elif JUCE_WINDOWS
  45. #include <windowsx.h>
  46. #include <vfw.h>
  47. #include <commdlg.h>
  48. #if JUCE_WEB_BROWSER
  49. #include <exdisp.h>
  50. #include <exdispid.h>
  51. #endif
  52. #if JUCE_MSVC && ! JUCE_DONT_AUTOLINK_TO_WIN32_LIBRARIES
  53. #pragma comment(lib, "vfw32.lib")
  54. #pragma comment(lib, "imm32.lib")
  55. #endif
  56. #if JUCE_OPENGL
  57. #if JUCE_MSVC && ! JUCE_DONT_AUTOLINK_TO_WIN32_LIBRARIES
  58. #pragma comment(lib, "OpenGL32.Lib")
  59. #pragma comment(lib, "GlU32.Lib")
  60. #endif
  61. #endif
  62. #if JUCE_DIRECT2D && JUCE_MSVC && ! JUCE_DONT_AUTOLINK_TO_WIN32_LIBRARIES
  63. #pragma comment (lib, "Dwrite.lib")
  64. #pragma comment (lib, "D2d1.lib")
  65. #endif
  66. #if JUCE_MINGW
  67. #include <imm.h>
  68. #define JUCE_DISABLE_WIN32_DPI_AWARENESS 1
  69. #endif
  70. //==============================================================================
  71. #elif JUCE_LINUX
  72. #include <X11/Xlib.h>
  73. #include <X11/Xatom.h>
  74. #include <X11/Xresource.h>
  75. #include <X11/Xutil.h>
  76. #include <X11/Xmd.h>
  77. #include <X11/keysym.h>
  78. #include <X11/XKBlib.h>
  79. #include <X11/cursorfont.h>
  80. #include <unistd.h>
  81. #if JUCE_USE_XRANDR
  82. /* If you're trying to use Xrandr, you'll need to install the "libxrandr-dev" package.. */
  83. #include <X11/extensions/Xrandr.h>
  84. #endif
  85. #if JUCE_USE_XINERAMA
  86. /* If you're trying to use Xinerama, you'll need to install the "libxinerama-dev" package.. */
  87. #include <X11/extensions/Xinerama.h>
  88. #endif
  89. #if JUCE_USE_XSHM
  90. #include <X11/extensions/XShm.h>
  91. #include <sys/shm.h>
  92. #include <sys/ipc.h>
  93. #endif
  94. #if JUCE_USE_XRENDER
  95. // If you're missing these headers, try installing the libxrender-dev and libxcomposite-dev
  96. #include <X11/extensions/Xrender.h>
  97. #include <X11/extensions/Xcomposite.h>
  98. #endif
  99. #if JUCE_USE_XCURSOR
  100. // If you're missing this header, try installing the libxcursor-dev package
  101. #include <X11/Xcursor/Xcursor.h>
  102. #endif
  103. #undef SIZEOF
  104. #undef KeyPress
  105. #endif
  106. #include <map>
  107. #include <set>
  108. //==============================================================================
  109. #define ASSERT_MESSAGE_MANAGER_IS_LOCKED \
  110. jassert (MessageManager::getInstance()->currentThreadHasLockedMessageManager());
  111. #define ASSERT_MESSAGE_MANAGER_IS_LOCKED_OR_OFFSCREEN \
  112. jassert (MessageManager::getInstance()->currentThreadHasLockedMessageManager() || getPeer() == nullptr);
  113. namespace juce
  114. {
  115. extern bool juce_areThereAnyAlwaysOnTopWindows();
  116. }
  117. #include "components/juce_Component.cpp"
  118. #include "components/juce_ComponentListener.cpp"
  119. #include "mouse/juce_MouseInputSource.cpp"
  120. #include "components/juce_Desktop.cpp"
  121. #include "components/juce_ModalComponentManager.cpp"
  122. #include "mouse/juce_ComponentDragger.cpp"
  123. #include "mouse/juce_DragAndDropContainer.cpp"
  124. #include "mouse/juce_MouseCursor.cpp"
  125. #include "mouse/juce_MouseEvent.cpp"
  126. #include "mouse/juce_MouseInactivityDetector.cpp"
  127. #include "mouse/juce_MouseListener.cpp"
  128. #include "keyboard/juce_CaretComponent.cpp"
  129. #include "keyboard/juce_KeyboardFocusTraverser.cpp"
  130. #include "keyboard/juce_KeyListener.cpp"
  131. #include "keyboard/juce_KeyPress.cpp"
  132. #include "keyboard/juce_ModifierKeys.cpp"
  133. #include "buttons/juce_ArrowButton.cpp"
  134. #include "buttons/juce_Button.cpp"
  135. #include "buttons/juce_DrawableButton.cpp"
  136. #include "buttons/juce_HyperlinkButton.cpp"
  137. #include "buttons/juce_ImageButton.cpp"
  138. #include "buttons/juce_ShapeButton.cpp"
  139. #include "buttons/juce_TextButton.cpp"
  140. #include "buttons/juce_ToggleButton.cpp"
  141. #include "buttons/juce_ToolbarButton.cpp"
  142. #include "drawables/juce_Drawable.cpp"
  143. #include "drawables/juce_DrawableComposite.cpp"
  144. #include "drawables/juce_DrawableImage.cpp"
  145. #include "drawables/juce_DrawablePath.cpp"
  146. #include "drawables/juce_DrawableRectangle.cpp"
  147. #include "drawables/juce_DrawableShape.cpp"
  148. #include "drawables/juce_DrawableText.cpp"
  149. #include "drawables/juce_SVGParser.cpp"
  150. #include "filebrowser/juce_DirectoryContentsDisplayComponent.cpp"
  151. #include "filebrowser/juce_DirectoryContentsList.cpp"
  152. #include "filebrowser/juce_FileBrowserComponent.cpp"
  153. #include "filebrowser/juce_FileChooser.cpp"
  154. #include "filebrowser/juce_FileChooserDialogBox.cpp"
  155. #include "filebrowser/juce_FileListComponent.cpp"
  156. #include "filebrowser/juce_FilenameComponent.cpp"
  157. #include "filebrowser/juce_FileSearchPathListComponent.cpp"
  158. #include "filebrowser/juce_FileTreeComponent.cpp"
  159. #include "filebrowser/juce_ImagePreviewComponent.cpp"
  160. #include "layout/juce_ComponentAnimator.cpp"
  161. #include "layout/juce_ComponentBoundsConstrainer.cpp"
  162. #include "layout/juce_ComponentBuilder.cpp"
  163. #include "layout/juce_ComponentMovementWatcher.cpp"
  164. #include "layout/juce_ConcertinaPanel.cpp"
  165. #include "layout/juce_GroupComponent.cpp"
  166. #include "layout/juce_MultiDocumentPanel.cpp"
  167. #include "layout/juce_ResizableBorderComponent.cpp"
  168. #include "layout/juce_ResizableCornerComponent.cpp"
  169. #include "layout/juce_ResizableEdgeComponent.cpp"
  170. #include "layout/juce_ScrollBar.cpp"
  171. #include "layout/juce_StretchableLayoutManager.cpp"
  172. #include "layout/juce_StretchableLayoutResizerBar.cpp"
  173. #include "layout/juce_StretchableObjectResizer.cpp"
  174. #include "layout/juce_TabbedButtonBar.cpp"
  175. #include "layout/juce_TabbedComponent.cpp"
  176. #include "layout/juce_Viewport.cpp"
  177. #include "lookandfeel/juce_LookAndFeel.cpp"
  178. #include "lookandfeel/juce_LookAndFeel_V2.cpp"
  179. #include "lookandfeel/juce_LookAndFeel_V1.cpp"
  180. #include "lookandfeel/juce_LookAndFeel_V3.cpp"
  181. #include "lookandfeel/juce_LookAndFeel_V4.cpp"
  182. #include "menus/juce_MenuBarComponent.cpp"
  183. #include "menus/juce_MenuBarModel.cpp"
  184. #include "menus/juce_PopupMenu.cpp"
  185. #include "positioning/juce_MarkerList.cpp"
  186. #include "positioning/juce_RelativeCoordinate.cpp"
  187. #include "positioning/juce_RelativeCoordinatePositioner.cpp"
  188. #include "positioning/juce_RelativeParallelogram.cpp"
  189. #include "positioning/juce_RelativePoint.cpp"
  190. #include "positioning/juce_RelativePointPath.cpp"
  191. #include "positioning/juce_RelativeRectangle.cpp"
  192. #include "properties/juce_BooleanPropertyComponent.cpp"
  193. #include "properties/juce_ButtonPropertyComponent.cpp"
  194. #include "properties/juce_ChoicePropertyComponent.cpp"
  195. #include "properties/juce_PropertyComponent.cpp"
  196. #include "properties/juce_PropertyPanel.cpp"
  197. #include "properties/juce_SliderPropertyComponent.cpp"
  198. #include "properties/juce_TextPropertyComponent.cpp"
  199. #include "widgets/juce_ComboBox.cpp"
  200. #include "widgets/juce_ImageComponent.cpp"
  201. #include "widgets/juce_Label.cpp"
  202. #include "widgets/juce_ListBox.cpp"
  203. #include "widgets/juce_ProgressBar.cpp"
  204. #include "widgets/juce_Slider.cpp"
  205. #include "widgets/juce_TableHeaderComponent.cpp"
  206. #include "widgets/juce_TableListBox.cpp"
  207. #include "widgets/juce_TextEditor.cpp"
  208. #include "widgets/juce_ToolbarItemComponent.cpp"
  209. #include "widgets/juce_Toolbar.cpp"
  210. #include "widgets/juce_ToolbarItemPalette.cpp"
  211. #include "widgets/juce_TreeView.cpp"
  212. #include "windows/juce_AlertWindow.cpp"
  213. #include "windows/juce_CallOutBox.cpp"
  214. #include "windows/juce_ComponentPeer.cpp"
  215. #include "windows/juce_DialogWindow.cpp"
  216. #include "windows/juce_DocumentWindow.cpp"
  217. #include "windows/juce_ResizableWindow.cpp"
  218. #include "windows/juce_ThreadWithProgressWindow.cpp"
  219. #include "windows/juce_TooltipWindow.cpp"
  220. #include "windows/juce_TopLevelWindow.cpp"
  221. #include "commands/juce_ApplicationCommandInfo.cpp"
  222. #include "commands/juce_ApplicationCommandManager.cpp"
  223. #include "commands/juce_ApplicationCommandTarget.cpp"
  224. #include "commands/juce_KeyPressMappingSet.cpp"
  225. #include "application/juce_Application.cpp"
  226. #include "misc/juce_BubbleComponent.cpp"
  227. #include "misc/juce_DropShadower.cpp"
  228. // these classes are C++11-only
  229. #if JUCE_COMPILER_SUPPORTS_INITIALIZER_LISTS
  230. #include "layout/juce_FlexBox.cpp"
  231. #if JUCE_HAS_CONSTEXPR
  232. #include "layout/juce_GridItem.cpp"
  233. #include "layout/juce_Grid.cpp"
  234. #if JUCE_UNIT_TESTS
  235. #include "layout/juce_GridUnitTests.cpp"
  236. #endif
  237. #endif
  238. #endif
  239. #if JUCE_IOS || JUCE_WINDOWS
  240. #include "native/juce_MultiTouchMapper.h"
  241. #endif
  242. #if JUCE_MAC || JUCE_IOS
  243. #if JUCE_CLANG
  244. #pragma clang diagnostic push
  245. #pragma clang diagnostic ignored "-Wundeclared-selector"
  246. #endif
  247. #if JUCE_IOS
  248. #include "native/juce_ios_UIViewComponentPeer.mm"
  249. #include "native/juce_ios_Windowing.mm"
  250. #else
  251. #include "native/juce_mac_NSViewComponentPeer.mm"
  252. #include "native/juce_mac_Windowing.mm"
  253. #include "native/juce_mac_MainMenu.mm"
  254. #endif
  255. #if JUCE_CLANG
  256. #pragma clang diagnostic pop
  257. #endif
  258. #include "native/juce_mac_MouseCursor.mm"
  259. #include "native/juce_mac_FileChooser.mm"
  260. #elif JUCE_WINDOWS
  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
  265. #include "native/juce_linux_X11.cpp"
  266. #include "native/juce_linux_X11_Clipboard.cpp"
  267. #include "native/juce_linux_X11_Windowing.cpp"
  268. #include "native/juce_linux_FileChooser.cpp"
  269. #elif JUCE_ANDROID
  270. #include "native/juce_android_Windowing.cpp"
  271. #include "native/juce_android_FileChooser.cpp"
  272. #endif