Team Fortress 2 Source Code as on 22/4/2020
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.

534 lines
16 KiB

  1. /*
  2. File: MacApplication.h
  3. Contains: Application-level APIs
  4. Version: QuickTime 7.3
  5. Copyright: (c) 2007 (c) 2000-2001 by Apple Computer, Inc., all rights reserved.
  6. Bugs?: For bug reports, consult the following page on
  7. the World Wide Web:
  8. http://developer.apple.com/bugreporter/
  9. */
  10. #ifndef __MACAPPLICATION__
  11. #define __MACAPPLICATION__
  12. #ifndef __CGCONTEXT__
  13. #include <CGContext.h>
  14. #endif
  15. #ifndef __QUICKDRAW__
  16. #include <Quickdraw.h>
  17. #endif
  18. #ifndef __MENUS__
  19. #include <Menus.h>
  20. #endif
  21. #ifndef __HIOBJECT__
  22. #include <HIObject.h>
  23. #endif
  24. #if PRAGMA_ONCE
  25. #pragma once
  26. #endif
  27. #ifdef __cplusplus
  28. extern "C" {
  29. #endif
  30. #if PRAGMA_IMPORT
  31. #pragma import on
  32. #endif
  33. /*
  34. * Summary:
  35. * Controls the presentation of system-provided user interface
  36. * elements.
  37. *
  38. * Discussion:
  39. * Note that the system UI mode is a per-process state. Switching
  40. * from a process that is suppressing system UI to another process
  41. * that is not will cause system UI elements to become visible
  42. * automatically. Switching back to the first process will suppress
  43. * system UI elements again.
  44. */
  45. enum {
  46. /*
  47. * In this mode, all standard system UI elements are visible.
  48. */
  49. kUIModeNormal = 0,
  50. /*
  51. * In this mode, system UI elements which cover the "content area" of
  52. * the screen (the area other than the menubar) are hidden. However,
  53. * these elements may automatically show themselves in response to
  54. * mouse movements or other user activity; specifically, the Dock
  55. * will still show itself automatically when the mouse moves into the
  56. * Dock's auto-show region.
  57. */
  58. kUIModeContentSuppressed = 1,
  59. /*
  60. * In this mode, system UI elements which cover the "content area" of
  61. * the screen (the area other than the menubar) are hidden. Unlike
  62. * kUIModeContentSuppressed, most UI elements will not automatically
  63. * show themselves in this mode.
  64. */
  65. kUIModeContentHidden = 2,
  66. /*
  67. * In this mode, all system UI elements, including the menubar, are
  68. * hidden. Most system UI elements will not automatically show
  69. * themselves in this mode. The application may request that the
  70. * menubar automatically show itself while in this mode by passing
  71. * the kUIOptionAutoShowMenuBar flag to SetSystemUIMode.
  72. */
  73. kUIModeAllHidden = 3
  74. };
  75. typedef UInt32 SystemUIMode;
  76. /*
  77. * Summary:
  78. * Controls optional behavior of system-provided user interface
  79. * elements.
  80. */
  81. enum {
  82. /*
  83. * Requests that the menubar automatically show itself when the user
  84. * moves the mouse into the screen area that would ordinarily be
  85. * occupied by the menubar. Only valid with kUIModeAllHidden.
  86. */
  87. kUIOptionAutoShowMenuBar = 1 << 0,
  88. /*
  89. * Disables all items in the Apple menu. Valid for all modes.
  90. */
  91. kUIOptionDisableAppleMenu = 1 << 2,
  92. /*
  93. * The active application may not be changed while this process is
  94. * active. Currently disables the Command-Tab and Command-Shift-Tab
  95. * key sequences to switch the active process, and the global window
  96. * rotation key sequence selected by the user in the Keyboard
  97. * preference pane. SetFrontProcess may still be used to explicitly
  98. * switch the active process. Only valid with modes other than
  99. * kUIModeNormal.
  100. */
  101. kUIOptionDisableProcessSwitch = 1 << 3,
  102. /*
  103. * The Force Quit window may not be displayed while this process is
  104. * active. Currently disables the Command-Option-Escape key sequence
  105. * to open the Force Quit window and the Force Quit menu item in the
  106. * Apple menu. Only valid with modes other than kUIModeNormal.
  107. */
  108. kUIOptionDisableForceQuit = 1 << 4,
  109. /*
  110. * The current login session may not be terminated while this process
  111. * is active. Currently disables the Power key and the Restart, Shut
  112. * Down, and Log Out menu items in the Apple menu. Only valid with
  113. * modes other than kUIModeNormal.
  114. */
  115. kUIOptionDisableSessionTerminate = 1 << 5
  116. };
  117. typedef OptionBits SystemUIOptions;
  118. /*
  119. * SetSystemUIMode()
  120. *
  121. * Summary:
  122. * Sets the presentation mode for system-provided user interface
  123. * elements.
  124. *
  125. * Discussion:
  126. * The presentation mode of an application determines which
  127. * system-provided user interface elements are visible on thes
  128. * screen. When the frontmost application changes its presentation
  129. * mode, a kEventAppSystemUIModeChanged Carbon event is sent to all
  130. * applications that have registered for the event. This event is
  131. * also sent when an application is activated; it contains the newly
  132. * active application's presentation mode.
  133. *
  134. * Parameters:
  135. *
  136. * inMode:
  137. * The new mode.
  138. *
  139. * inOptions:
  140. * Options controlling how the new mode behaves.
  141. *
  142. * Result:
  143. * An operating system result code.
  144. *
  145. * Availability:
  146. * Non-Carbon CFM: not available
  147. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  148. * Mac OS X: in version 10.2 and later
  149. */
  150. EXTERN_API_C( OSStatus )
  151. SetSystemUIMode(
  152. SystemUIMode inMode,
  153. SystemUIOptions inOptions);
  154. /*
  155. * GetSystemUIMode()
  156. *
  157. * Summary:
  158. * Returns the current presentation mode of the application.
  159. *
  160. * Parameters:
  161. *
  162. * outMode:
  163. * On exit, contains the current mode. You may pass NULL if you
  164. * don't need this information.
  165. *
  166. * outOptions:
  167. * On exit, contains the current options for the mode. You may
  168. * pass NULL if you don't need this information.
  169. *
  170. * Availability:
  171. * Non-Carbon CFM: not available
  172. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  173. * Mac OS X: in version 10.2 and later
  174. */
  175. EXTERN_API_C( void )
  176. GetSystemUIMode(
  177. SystemUIMode * outMode, /* can be NULL */
  178. SystemUIOptions * outOptions); /* can be NULL */
  179. /*
  180. * HIApplicationGetCurrent()
  181. *
  182. * Discussion:
  183. * Returns the HIObjectRef of the currently running application
  184. * object. This HIObject's EventTargetRef is what will be returned
  185. * from GetApplicationEventTarget.
  186. *
  187. * Result:
  188. * The HIObjectRef of the currently running application object.
  189. *
  190. * Availability:
  191. * Non-Carbon CFM: not available
  192. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  193. * Mac OS X: in version 10.2 and later
  194. */
  195. EXTERN_API_C( HIObjectRef )
  196. HIApplicationGetCurrent(void);
  197. /*
  198. * SetApplicationDockTileImage()
  199. *
  200. * Discussion:
  201. * Sets the image for the tile in the dock that represents your
  202. * application while it is running. If you set the image, it will
  203. * NOT revert back to its original image when your application
  204. * terminates. You need to manually restore it before quitting.
  205. *
  206. * Parameters:
  207. *
  208. * inImage:
  209. * The image you wish to have as your tile image.
  210. *
  211. * Result:
  212. * An operating system status code.
  213. *
  214. * Availability:
  215. * Non-Carbon CFM: not available
  216. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
  217. * Mac OS X: in version 10.0 and later
  218. */
  219. EXTERN_API_C( OSStatus )
  220. SetApplicationDockTileImage(CGImageRef inImage);
  221. /*
  222. * OverlayApplicationDockTileImage()
  223. *
  224. * Discussion:
  225. * Takes the image passed in and composites it on top of the current
  226. * image of your application's dock tile. You might do this to put a
  227. * standard badge over your application's icon to indicate something
  228. * to the user.
  229. *
  230. * Parameters:
  231. *
  232. * inImage:
  233. * The image you wish to overlay onto your tile image.
  234. *
  235. * Result:
  236. * An operating system status code.
  237. *
  238. * Availability:
  239. * Non-Carbon CFM: not available
  240. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
  241. * Mac OS X: in version 10.0 and later
  242. */
  243. EXTERN_API_C( OSStatus )
  244. OverlayApplicationDockTileImage(CGImageRef inImage);
  245. /*
  246. * RestoreApplicationDockTileImage()
  247. *
  248. * Discussion:
  249. * Restores the tile for your appliation in the dock to its normal
  250. * image (your application icon). You would use this if some overlay
  251. * or change of the application icon needed to be removed.
  252. *
  253. * Result:
  254. * An operating system status code.
  255. *
  256. * Availability:
  257. * Non-Carbon CFM: not available
  258. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
  259. * Mac OS X: in version 10.0 and later
  260. */
  261. EXTERN_API_C( OSStatus )
  262. RestoreApplicationDockTileImage(void);
  263. /*
  264. * BeginCGContextForApplicationDockTile()
  265. *
  266. * Discussion:
  267. * Creates and returns a CGContextRef. You can use this context to
  268. * draw into your application's dock tile with Quartz. You **MUST**
  269. * call EndCGContextForApplicationDockTile and NOT CGEndContext when
  270. * using this API, as it locks your application's tile in the dock.
  271. * If you call CGEndContext, the dock will never know you are done
  272. * with the tile.
  273. *
  274. * Result:
  275. * An Quartz (Core Graphics) context reference.
  276. *
  277. * Availability:
  278. * Non-Carbon CFM: not available
  279. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
  280. * Mac OS X: in version 10.0 and later
  281. */
  282. EXTERN_API_C( CGContextRef )
  283. BeginCGContextForApplicationDockTile(void);
  284. /*
  285. * EndCGContextForApplicationDockTile()
  286. *
  287. * Discussion:
  288. * Ends the CG context for your application tile and frees the lock
  289. * on the application dock tile. You **MUST** call this routine and
  290. * NOT CGEndContext when using BeginCGContextForApplicationDockTile,
  291. * as it locks your application's tile in the dock. If you call
  292. * CGEndContext, the dock will never know you are done with the tile.
  293. *
  294. * Parameters:
  295. *
  296. * inContext:
  297. * The context to end. The context is invalid after this call and
  298. * should no longer be used.
  299. *
  300. * Availability:
  301. * Non-Carbon CFM: not available
  302. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
  303. * Mac OS X: in version 10.0 and later
  304. */
  305. EXTERN_API_C( void )
  306. EndCGContextForApplicationDockTile(CGContextRef inContext);
  307. /*
  308. * BeginQDContextForApplicationDockTile()
  309. *
  310. * Discussion:
  311. * Creates and returns a CGrafPtr for your application's tile in the
  312. * dock. You can use this port to draw into your application's dock
  313. * tile with Quickdraw. You **MUST** call
  314. * EndQDContextForApplicationDockTile and NOT DisposePort when using
  315. * this API, as it locks your application's tile in the dock. If you
  316. * call DisposePort, the dock will never know you are done with the
  317. * tile.
  318. *
  319. * Result:
  320. * A Quickdraw port reference.
  321. *
  322. * Availability:
  323. * Non-Carbon CFM: not available
  324. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
  325. * Mac OS X: in version 10.0 and later
  326. */
  327. EXTERN_API_C( CGrafPtr )
  328. BeginQDContextForApplicationDockTile(void);
  329. /*
  330. * EndQDContextForApplicationDockTile()
  331. *
  332. * Discussion:
  333. * Disposes the Quickdraw port for your application tile and frees
  334. * the lock on the application dock tile. You **MUST** call this
  335. * routine and NOT DisposePort when using
  336. * BeginQDContextForApplicationDockTile, else the dock will never
  337. * know you are done with the tile.
  338. *
  339. * Parameters:
  340. *
  341. * inContext:
  342. * The context to end. The context is invalid after this call and
  343. * should no longer be used.
  344. *
  345. * Availability:
  346. * Non-Carbon CFM: not available
  347. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
  348. * Mac OS X: in version 10.0 and later
  349. */
  350. EXTERN_API_C( void )
  351. EndQDContextForApplicationDockTile(CGrafPtr inContext);
  352. /*
  353. * SetApplicationDockTileMenu()
  354. *
  355. * Summary:
  356. * Sets the menu that is displayed by the application's dock tile.
  357. *
  358. * Discussion:
  359. * The Carbon Window Manager and the Dock will always automatically
  360. * display a menu containing a list of the application's document
  361. * windows. If the application wants to add other additional menu
  362. * items, it can use the SetApplicationDockTileMenu API to provide
  363. * those items. The items in the specified menu will be combined
  364. * with the window title items. This API increments the refcount of
  365. * the specified menu. Before the menu is actually displayed, it
  366. * will receive kEventMenuPopulate, kEventMenuOpening, and
  367. * kEventMenuEnableItems Carbon events, so any event handlers for
  368. * these events may update the menu appropriately for the current
  369. * state of the application. The application should set a command ID
  370. * for each menu item in the dock tile menu, and when that item is
  371. * chosen, a kEventCommandProcess Carbon event containing the item's
  372. * command ID will be sent to the user focus target.
  373. *
  374. * Parameters:
  375. *
  376. * inMenu:
  377. * The menu to display, or NULL to remove the current dock tile
  378. * menu.
  379. *
  380. * Availability:
  381. * Non-Carbon CFM: not available
  382. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.1 and later
  383. * Mac OS X: in version 10.1 and later
  384. */
  385. EXTERN_API_C( OSStatus )
  386. SetApplicationDockTileMenu(MenuRef inMenu);
  387. /*
  388. * GetApplicationDockTileMenu()
  389. *
  390. * Summary:
  391. * Returns the menu that is displayed by the application's dock tile.
  392. *
  393. * Result:
  394. * The application's dock tile menu, or NULL if none.
  395. *
  396. * Availability:
  397. * Non-Carbon CFM: not available
  398. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.1 and later
  399. * Mac OS X: in version 10.1 and later
  400. */
  401. EXTERN_API_C( MenuRef )
  402. GetApplicationDockTileMenu(void);
  403. /*
  404. * CreateCGImageFromPixMaps()
  405. *
  406. * Availability:
  407. * Non-Carbon CFM: not available
  408. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
  409. * Mac OS X: in version 10.0 and later
  410. */
  411. EXTERN_API_C( OSStatus )
  412. CreateCGImageFromPixMaps(
  413. PixMapHandle inImage,
  414. PixMapHandle inMask,
  415. CGImageRef * outImage);
  416. /*
  417. * GetApplicationTextEncoding()
  418. *
  419. * Summary:
  420. * Returns the application's primary text encoding.
  421. *
  422. * Discussion:
  423. * The application text encoding is used when you create a
  424. * CFStringRef from text stored in Resource Manager resources, which
  425. * typically uses one of the Mac encodings such as MacRoman or
  426. * MacJapanese. The encoding is determined by: (a) if your app is
  427. * bundled, the encoding of the .lproj directory chosen by CFBundle,
  428. * (b) else if your plist has a CFBundleDevelopmentRegionKey, the
  429. * encoding specified by that key, (c) else if your app has a 'vers'
  430. * resource, the encoding for the region field in the 'vers', (d)
  431. * else the current localization of the operating system.
  432. *
  433. * Availability:
  434. * Non-Carbon CFM: not available
  435. * CarbonLib: in CarbonLib 1.2 and later
  436. * Mac OS X: in version 10.0 and later
  437. */
  438. EXTERN_API( TextEncoding )
  439. GetApplicationTextEncoding(void);
  440. /*
  441. * GetApplicationScript()
  442. *
  443. * Summary:
  444. * Returns the application script.
  445. *
  446. * Discussion:
  447. * The application script is used when you need a ScriptCode to pass
  448. * to some other API, such as UseThemeFont.
  449. *
  450. * Availability:
  451. * Non-Carbon CFM: not available
  452. * CarbonLib: in CarbonLib 1.3 and later
  453. * Mac OS X: in version 10.0 and later
  454. */
  455. EXTERN_API( ScriptCode )
  456. GetApplicationScript(void);
  457. #ifdef PRAGMA_IMPORT_OFF
  458. #pragma import off
  459. #elif PRAGMA_IMPORT
  460. #pragma import reset
  461. #endif
  462. #ifdef __cplusplus
  463. }
  464. #endif
  465. #endif /* __MACAPPLICATION__ */