CGWindowLevels.pas 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  1. { CoreGraphics - CGWindowLevel.h
  2. Copyright (c) 2000-2008 Apple Inc.
  3. All rights reserved. }
  4. { Pascal Translation Updated: Jonas Maebe, <[email protected]>, October 2009 }
  5. { Pascal Translation Updated: Jonas Maebe, <[email protected]>, October 2012 }
  6. { Pascal Translation Updated: Jonas Maebe, <[email protected]>, August 2015 }
  7. {
  8. Modified for use with Free Pascal
  9. Version 308
  10. Please report any bugs to <[email protected]>
  11. }
  12. {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
  13. {$mode macpas}
  14. {$packenum 1}
  15. {$macro on}
  16. {$inline on}
  17. {$calling mwpascal}
  18. unit CGWindowLevels;
  19. interface
  20. {$setc UNIVERSAL_INTERFACES_VERSION := $0400}
  21. {$setc GAP_INTERFACES_VERSION := $0308}
  22. {$ifc not defined USE_CFSTR_CONSTANT_MACROS}
  23. {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
  24. {$endc}
  25. {$ifc defined CPUPOWERPC and defined CPUI386}
  26. {$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
  27. {$endc}
  28. {$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
  29. {$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
  30. {$endc}
  31. {$ifc not defined __ppc__ and defined CPUPOWERPC32}
  32. {$setc __ppc__ := 1}
  33. {$elsec}
  34. {$setc __ppc__ := 0}
  35. {$endc}
  36. {$ifc not defined __ppc64__ and defined CPUPOWERPC64}
  37. {$setc __ppc64__ := 1}
  38. {$elsec}
  39. {$setc __ppc64__ := 0}
  40. {$endc}
  41. {$ifc not defined __i386__ and defined CPUI386}
  42. {$setc __i386__ := 1}
  43. {$elsec}
  44. {$setc __i386__ := 0}
  45. {$endc}
  46. {$ifc not defined __x86_64__ and defined CPUX86_64}
  47. {$setc __x86_64__ := 1}
  48. {$elsec}
  49. {$setc __x86_64__ := 0}
  50. {$endc}
  51. {$ifc not defined __arm__ and defined CPUARM}
  52. {$setc __arm__ := 1}
  53. {$elsec}
  54. {$setc __arm__ := 0}
  55. {$endc}
  56. {$ifc not defined __arm64__ and defined CPUAARCH64}
  57. {$setc __arm64__ := 1}
  58. {$elsec}
  59. {$setc __arm64__ := 0}
  60. {$endc}
  61. {$ifc defined cpu64}
  62. {$setc __LP64__ := 1}
  63. {$elsec}
  64. {$setc __LP64__ := 0}
  65. {$endc}
  66. {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
  67. {$error Conflicting definitions for __ppc__ and __i386__}
  68. {$endc}
  69. {$ifc defined __ppc__ and __ppc__}
  70. {$setc TARGET_CPU_PPC := TRUE}
  71. {$setc TARGET_CPU_PPC64 := FALSE}
  72. {$setc TARGET_CPU_X86 := FALSE}
  73. {$setc TARGET_CPU_X86_64 := FALSE}
  74. {$setc TARGET_CPU_ARM := FALSE}
  75. {$setc TARGET_CPU_ARM64 := FALSE}
  76. {$setc TARGET_OS_MAC := TRUE}
  77. {$setc TARGET_OS_IPHONE := FALSE}
  78. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  79. {$setc TARGET_OS_EMBEDDED := FALSE}
  80. {$elifc defined __ppc64__ and __ppc64__}
  81. {$setc TARGET_CPU_PPC := FALSE}
  82. {$setc TARGET_CPU_PPC64 := TRUE}
  83. {$setc TARGET_CPU_X86 := FALSE}
  84. {$setc TARGET_CPU_X86_64 := FALSE}
  85. {$setc TARGET_CPU_ARM := FALSE}
  86. {$setc TARGET_CPU_ARM64 := FALSE}
  87. {$setc TARGET_OS_MAC := TRUE}
  88. {$setc TARGET_OS_IPHONE := FALSE}
  89. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  90. {$setc TARGET_OS_EMBEDDED := FALSE}
  91. {$elifc defined __i386__ and __i386__}
  92. {$setc TARGET_CPU_PPC := FALSE}
  93. {$setc TARGET_CPU_PPC64 := FALSE}
  94. {$setc TARGET_CPU_X86 := TRUE}
  95. {$setc TARGET_CPU_X86_64 := FALSE}
  96. {$setc TARGET_CPU_ARM := FALSE}
  97. {$setc TARGET_CPU_ARM64 := FALSE}
  98. {$ifc defined(iphonesim)}
  99. {$setc TARGET_OS_MAC := FALSE}
  100. {$setc TARGET_OS_IPHONE := TRUE}
  101. {$setc TARGET_IPHONE_SIMULATOR := TRUE}
  102. {$elsec}
  103. {$setc TARGET_OS_MAC := TRUE}
  104. {$setc TARGET_OS_IPHONE := FALSE}
  105. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  106. {$endc}
  107. {$setc TARGET_OS_EMBEDDED := FALSE}
  108. {$elifc defined __x86_64__ and __x86_64__}
  109. {$setc TARGET_CPU_PPC := FALSE}
  110. {$setc TARGET_CPU_PPC64 := FALSE}
  111. {$setc TARGET_CPU_X86 := FALSE}
  112. {$setc TARGET_CPU_X86_64 := TRUE}
  113. {$setc TARGET_CPU_ARM := FALSE}
  114. {$setc TARGET_CPU_ARM64 := FALSE}
  115. {$ifc defined(iphonesim)}
  116. {$setc TARGET_OS_MAC := FALSE}
  117. {$setc TARGET_OS_IPHONE := TRUE}
  118. {$setc TARGET_IPHONE_SIMULATOR := TRUE}
  119. {$elsec}
  120. {$setc TARGET_OS_MAC := TRUE}
  121. {$setc TARGET_OS_IPHONE := FALSE}
  122. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  123. {$endc}
  124. {$setc TARGET_OS_EMBEDDED := FALSE}
  125. {$elifc defined __arm__ and __arm__}
  126. {$setc TARGET_CPU_PPC := FALSE}
  127. {$setc TARGET_CPU_PPC64 := FALSE}
  128. {$setc TARGET_CPU_X86 := FALSE}
  129. {$setc TARGET_CPU_X86_64 := FALSE}
  130. {$setc TARGET_CPU_ARM := TRUE}
  131. {$setc TARGET_CPU_ARM64 := FALSE}
  132. { will require compiler define when/if other Apple devices with ARM cpus ship }
  133. {$setc TARGET_OS_MAC := FALSE}
  134. {$setc TARGET_OS_IPHONE := TRUE}
  135. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  136. {$setc TARGET_OS_EMBEDDED := TRUE}
  137. {$elifc defined __arm64__ and __arm64__}
  138. {$setc TARGET_CPU_PPC := FALSE}
  139. {$setc TARGET_CPU_PPC64 := FALSE}
  140. {$setc TARGET_CPU_X86 := FALSE}
  141. {$setc TARGET_CPU_X86_64 := FALSE}
  142. {$setc TARGET_CPU_ARM := FALSE}
  143. {$setc TARGET_CPU_ARM64 := TRUE}
  144. { will require compiler define when/if other Apple devices with ARM cpus ship }
  145. {$setc TARGET_OS_MAC := FALSE}
  146. {$setc TARGET_OS_IPHONE := TRUE}
  147. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  148. {$setc TARGET_OS_EMBEDDED := TRUE}
  149. {$elsec}
  150. {$error __ppc__ nor __ppc64__ nor __i386__ nor __x86_64__ nor __arm__ nor __arm64__ is defined.}
  151. {$endc}
  152. {$ifc defined __LP64__ and __LP64__ }
  153. {$setc TARGET_CPU_64 := TRUE}
  154. {$elsec}
  155. {$setc TARGET_CPU_64 := FALSE}
  156. {$endc}
  157. {$ifc defined FPC_BIG_ENDIAN}
  158. {$setc TARGET_RT_BIG_ENDIAN := TRUE}
  159. {$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
  160. {$elifc defined FPC_LITTLE_ENDIAN}
  161. {$setc TARGET_RT_BIG_ENDIAN := FALSE}
  162. {$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
  163. {$elsec}
  164. {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
  165. {$endc}
  166. {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
  167. {$setc CALL_NOT_IN_CARBON := FALSE}
  168. {$setc OLDROUTINENAMES := FALSE}
  169. {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
  170. {$setc OPAQUE_UPP_TYPES := TRUE}
  171. {$setc OTCARBONAPPLICATION := TRUE}
  172. {$setc OTKERNEL := FALSE}
  173. {$setc PM_USE_SESSION_APIS := TRUE}
  174. {$setc TARGET_API_MAC_CARBON := TRUE}
  175. {$setc TARGET_API_MAC_OS8 := FALSE}
  176. {$setc TARGET_API_MAC_OSX := TRUE}
  177. {$setc TARGET_CARBON := TRUE}
  178. {$setc TARGET_CPU_68K := FALSE}
  179. {$setc TARGET_CPU_MIPS := FALSE}
  180. {$setc TARGET_CPU_SPARC := FALSE}
  181. {$setc TARGET_OS_UNIX := FALSE}
  182. {$setc TARGET_OS_WIN32 := FALSE}
  183. {$setc TARGET_RT_MAC_68881 := FALSE}
  184. {$setc TARGET_RT_MAC_CFM := FALSE}
  185. {$setc TARGET_RT_MAC_MACHO := TRUE}
  186. {$setc TYPED_FUNCTION_POINTERS := TRUE}
  187. {$setc TYPE_BOOL := FALSE}
  188. {$setc TYPE_EXTENDED := FALSE}
  189. {$setc TYPE_LONGLONG := TRUE}
  190. uses MacTypes,CGBase;
  191. {$endc} {not MACOSALLINCLUDE}
  192. {$ALIGN POWER}
  193. { Windows may be assigned to a particular level. When assigned to a level,
  194. the window is ordered relative to all other windows in that level.
  195. Windows with a higher level are sorted in front of windows with a lower
  196. level.
  197. A common set of window levels is defined here for use within higher level
  198. frameworks. The levels are accessed via a key and function, so that
  199. levels may be changed or adjusted in future releases without breaking
  200. binary compatability. }
  201. type
  202. CGWindowLevel = SInt32;
  203. CGWindowLevelKey = SInt32;
  204. const
  205. kCGBaseWindowLevelKey = 0;
  206. kCGMinimumWindowLevelKey = 1;
  207. kCGDesktopWindowLevelKey = 2;
  208. kCGBackstopMenuLevelKey = 3;
  209. kCGNormalWindowLevelKey = 4;
  210. kCGFloatingWindowLevelKey = 5;
  211. kCGTornOffMenuWindowLevelKey = 6;
  212. kCGDockWindowLevelKey = 7;
  213. kCGMainMenuWindowLevelKey = 8;
  214. kCGStatusWindowLevelKey = 9;
  215. kCGModalPanelWindowLevelKey = 10;
  216. kCGPopUpMenuWindowLevelKey = 11;
  217. kCGDraggingWindowLevelKey = 12;
  218. kCGScreenSaverWindowLevelKey = 13;
  219. kCGMaximumWindowLevelKey = 14;
  220. kCGOverlayWindowLevelKey = 15;
  221. kCGHelpWindowLevelKey = 16;
  222. kCGUtilityWindowLevelKey = 17;
  223. kCGDesktopIconWindowLevelKey = 18;
  224. kCGCursorWindowLevelKey = 19;
  225. kCGAssistiveTechHighWindowLevelKey = 20;
  226. kCGNumberOfWindowLevelKeys = 21; { Must be last. }
  227. {$ifc TARGET_OS_MAC}
  228. { Return the window level that corresponds to one of the standard window
  229. types. }
  230. function CGWindowLevelForKey( key: CGWindowLevelKey ): CGWindowLevel; external name '_CGWindowLevelForKey';
  231. (* CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
  232. {$endc}
  233. { The number of window levels reserved by Apple for internal use. }
  234. const
  235. kCGNumReservedWindowLevels = 16;
  236. (*
  237. { Definitions of older constant values as calls }
  238. #define kCGBaseWindowLevel CGWindowLevelForKey(kCGBaseWindowLevelKey) { LONG_MIN }
  239. #define kCGMinimumWindowLevel CGWindowLevelForKey(kCGMinimumWindowLevelKey) { (kCGBaseWindowLevel + 1) }
  240. #define kCGDesktopWindowLevel CGWindowLevelForKey(kCGDesktopWindowLevelKey) { kCGMinimumWindowLevel }
  241. #define kCGDesktopIconWindowLevel CGWindowLevelForKey(kCGDesktopIconWindowLevelKey) { kCGMinimumWindowLevel + 20 }
  242. #define kCGBackstopMenuLevel CGWindowLevelForKey(kCGBackstopMenuLevelKey) { -20 }
  243. #define kCGNormalWindowLevel CGWindowLevelForKey(kCGNormalWindowLevelKey) { 0 }
  244. #define kCGFloatingWindowLevel CGWindowLevelForKey(kCGFloatingWindowLevelKey) { 3 }
  245. #define kCGTornOffMenuWindowLevel CGWindowLevelForKey(kCGTornOffMenuWindowLevelKey) { 3 }
  246. #define kCGDockWindowLevel CGWindowLevelForKey(kCGDockWindowLevelKey) { 20 }
  247. #define kCGMainMenuWindowLevel CGWindowLevelForKey(kCGMainMenuWindowLevelKey) { 24 }
  248. #define kCGStatusWindowLevel CGWindowLevelForKey(kCGStatusWindowLevelKey) { 25 }
  249. #define kCGModalPanelWindowLevel CGWindowLevelForKey(kCGModalPanelWindowLevelKey) { 8 }
  250. #define kCGPopUpMenuWindowLevel CGWindowLevelForKey(kCGPopUpMenuWindowLevelKey) { 101 }
  251. #define kCGDraggingWindowLevel CGWindowLevelForKey(kCGDraggingWindowLevelKey) { 500 }
  252. #define kCGScreenSaverWindowLevel CGWindowLevelForKey(kCGScreenSaverWindowLevelKey) { 1000 }
  253. #define kCGCursorWindowLevel CGWindowLevelForKey(kCGCursorWindowLevelKey) { 2000 }
  254. #define kCGOverlayWindowLevel CGWindowLevelForKey(kCGOverlayWindowLevelKey) { 102 }
  255. #define kCGHelpWindowLevel CGWindowLevelForKey(kCGHelpWindowLevelKey) { 102 }
  256. #define kCGUtilityWindowLevel CGWindowLevelForKey(kCGUtilityWindowLevelKey) { 19 }
  257. #define kCGAssistiveTechHighWindowLevel CGWindowLevelForKey(kCGAssistiveTechHighWindowLevelKey) { 1500 }
  258. #define kCGMaximumWindowLevel CGWindowLevelForKey(kCGMaximumWindowLevelKey) { LONG_MAX - kCGNumReservedWindowLevels }
  259. *)
  260. {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
  261. end.
  262. {$endc} {not MACOSALLINCLUDE}