CGWindowLevels.pas 9.9 KB

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