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.

301 lines
12 KiB

  1. /*
  2. File: PMPrinterBrowsers.h
  3. Contains: Mac OS X Printing Manager Printer Browser Module Interfaces
  4. Version: QuickTime 7.3
  5. Copyright: (c) 2007 (c) 1999-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 __CONTROLS__
  11. #include <Controls.h>
  12. #endif
  13. #ifndef __CFUUID__
  14. #include <CFUUID.h>
  15. #endif
  16. #if PRAGMA_ONCE
  17. #pragma once
  18. #endif
  19. #ifdef __cplusplus
  20. extern "C" {
  21. #endif
  22. #if PRAGMA_IMPORT
  23. #pragma import on
  24. #endif
  25. #if PRAGMA_STRUCT_ALIGN
  26. #pragma options align=mac68k
  27. #elif PRAGMA_STRUCT_PACKPUSH
  28. #pragma pack(push, 2)
  29. #elif PRAGMA_STRUCT_PACK
  30. #pragma pack(2)
  31. #endif
  32. /*
  33. Current version of the printer browser module API, which specifies the format
  34. of the functions and various structures used in the API.
  35. */
  36. #define kPMPrBrowserAPIVersion 1
  37. /*
  38. Constants required for retrieving standard icons supplied by PrintCenter...
  39. Any standard icons supplied by PrintCenter for use in displaying printer
  40. browser HI will have been registered with Icon Services when the printer
  41. browser module is loaded. The printer browser module need only call GetIconRef()
  42. with the appropriate constants to obtain a reference to the required icon.
  43. PrintCenter creator code.
  44. */
  45. enum {
  46. kPMPrBrowserPCCreator = FOUR_CHAR_CODE('pctr'),
  47. kPMPrBrowserWorksetPrinterIconType = FOUR_CHAR_CODE('wspr'),
  48. kPMPrBrowserUnknownPrinterIconType = FOUR_CHAR_CODE('?ptr')
  49. };
  50. /*
  51. PrintCenter flags...
  52. These flags are passed by PrintCenter in the Prologue() function.
  53. */
  54. typedef UInt32 PMPrBrowserFlags;
  55. enum {
  56. kPMPrBrowserPCNoFlags = 0x00000000, /* Empty flag word. */
  57. kPMPrBrowserPCNoUI = 0x00000001, /* PBM will be loaded without UI. */
  58. kPMPrBrowserPCAllFlags = (unsigned long)0xFFFFFFFF /* All flags set. */
  59. };
  60. /*
  61. Printer browser module CFPlugIn constants.
  62. Define the CFPlugIn Type for printer browser modules. All printer browser modules
  63. must be plug-ins of this type.
  64. Users of these IDs should convert these to CFStrings (probably using the CFSTR
  65. macro) and then call CFUUIDCreateFromString() to obtain a CFUUIDRef. Note that
  66. the CFUUIDRef may refer to an existing CFUUID, so the caller should call
  67. CFRelease() on the CFUUIDRef() when he no longer needs it.
  68. */
  69. #define kPMPrBrowserPlugInType "23F71E46-95CC-1226-AC04-000502ADB00B"
  70. /*
  71. Define the ID of the Interface that supplies the APIVersion() function. All
  72. printer browser modules must supply this Interface.
  73. */
  74. #define kPMInterfaceAPIVersion "1D6BF822-95D0-1226-A8ED-000502ADB00B"
  75. /*
  76. Define the ID of the Interface that supplies the printer browser module API. All
  77. printer browser modules must supply this Interface.
  78. */
  79. #define kPMInterfacePrBrowser "86544C22-95D0-1226-91D5-000502ADB00B"
  80. /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  81. Type Definitions
  82. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
  83. typedef struct OpaquePMPrBrowserRef* PMPrBrowserRef;
  84. typedef struct OpaquePMPrBrowserContext* PMPrBrowserContext;
  85. /*
  86. Invalid printer browser reference number.
  87. */
  88. #define kPMPrBrowserInvalidRef ((PMPrBrowserRef)(-1))
  89. /*
  90. Printer browser module-specific keys for the printer lookup specification
  91. dictionary. This CFDictionary is supplied by the printer module and provides
  92. the printer browser module with the information it needs to browse for a given
  93. type of printer over its connection type, and to display it in the browser
  94. view.
  95. The printer module supplies the following keys and values (these are more
  96. fully defined in PMPrinterModule.h):
  97. kPMPrBrowserLookupKindKey: a CFStringRef to a human-readable printer type
  98. string that can be displayed in the browser view.
  99. kPMPrBrowserLookupInfoKey: a CFPropertyListRef to connection-specific
  100. information used to look up a particular kind of printer over a given IO
  101. connection.
  102. kPMPrBrowserLookupIconKey: a CFDataRef to the icon family data for the
  103. printer icon to be displayed in the browser view.
  104. In addition, PrintCenter adds the following information to the lookup
  105. specification dictionary:
  106. kPMPrBrowserLookupRefKey: a CFTypeRef to PrintCenter-specific information
  107. that must be returned by the printer browser module in the printer selection
  108. specfication dictionary (see below) when a printer is selected that was
  109. located using this lookup specification.
  110. PrintCenter informs the printer browser module of the number of lookup
  111. specification dictionaries that are available when the module's Initialize()
  112. function is called. Thereafter, the printer browser module can obtain
  113. a copy of any of the lookup specification dictionaries by calling the
  114. PMPrBrowserGetLookupSpec callback and specifying an index between 0 and n-1,
  115. where n is the number of lookup specification dictionaries.
  116. PrintCenter creates a full copy of the printer lookup specification dictionary
  117. before passing it to the printer browser module; the printer browser module
  118. should call ::CFRelease() on the dictionary when it is no longer needed.
  119. */
  120. #define kPMPrBrowserLookupRefStr "PrBrowser Lookup Reference"
  121. #define kPMPrBrowserLookupRefKey CFSTR("PrBrowser Lookup Reference")
  122. /*
  123. Keys for the printer selection specification dictionary. This CFDictionary
  124. specifies the printers selected in the browser view. An array of these
  125. dictionaries is is passed back to PrintCenter when it calls the printer
  126. browser module's GetSelectedPrinters() function.
  127. An array of selection specification dictionaries is passed from PrintCenter
  128. to the printer browser module when PrintCenter calls the WorksetPrinters()
  129. function. These dictionaries specify which printers are already in the
  130. Workset. The printer browser module can use this information to indicate in
  131. its UI whether a printer has been added to the Workset. It can also use
  132. this information in non-UI mode to avoid supplying duplicate printers during
  133. automatic printer discovery.
  134. kPMPrBrowserSelectNameKey corresponds to a CFStringRef to a human-readable
  135. printer name string, obtained from the printer or otherwise constructed by
  136. the printer browser module.
  137. kPMPrBrowserSelectKindKey corresponds to a CFStringRef to a human-readable
  138. printer description string that can be displayed in the PrintCenter Workset
  139. window. For printer that uses Apple's PostScript printer module over an
  140. AppleTalk connection, this would be the string "PostScript printer". Often
  141. this is the same as the string corresponding to kPMPrBrowserLookupKindKey
  142. in the printer lookup specification dictionary, but it is possible that
  143. more specific printer model information might be obtained by the printer
  144. browser module during the lookup.
  145. kPMPrBrowserSelectAddrKey corresponds to a CFDataRef to a connection-specific
  146. address specification for the printer. On an AppleTalk connection, this would
  147. be a standard NBP address of the form <name>:<type>@<zone>.
  148. kPMPrBrowserSelectRefKey corresponds to a CFTypeRef whose value is the same
  149. as that corresponding to kPMPrBrowserLookupRefKey in the printer lookup
  150. specification dictionary. The reference value in the lookup specification
  151. dictionary that was used to locate the selected printer must be copied into
  152. the printer selection specification dictionary and assigned this key.
  153. When PrintCenter supplies printer selection specification dictionaries using
  154. the WorksetPrinters() function, the dictionaries do not contain a
  155. kPMPrBrowserSelectRefKey entry; the printer browser module should not expect
  156. to find a corresponding value for this key in those dictionaries.
  157. PrintCenter gets information about selected printers when it calls the
  158. printer browser module's GetSelectedPrinters() function.
  159. PrintCenter will call ::CFRelease() on the printer selection specification
  160. dictionary when it is no longer needed.
  161. The printer browser module should call ::CFRelease() on the array of
  162. printer selection specification dictionaries supplied via the WorksetPrinters()
  163. function when they are no longer needed.
  164. */
  165. #define kPMPrBrowserSelectNameStr "PrBrowser Selection Name"
  166. #define kPMPrBrowserSelectNameKey CFSTR("PrBrowser Selection Name")
  167. #define kPMPrBrowserSelectKindStr "PrBrowser Selection Kind"
  168. #define kPMPrBrowserSelectKindKey CFSTR("PrBrowser Selection Kind")
  169. #define kPMPrBrowserSelectAddrStr "PrBrowser Selection Address"
  170. #define kPMPrBrowserSelectAddrKey CFSTR("PrBrowser Selection Address")
  171. #define kPMPrBrowserSelectRefStr "PrBrowser Selection Reference"
  172. #define kPMPrBrowserSelectRefKey CFSTR("PrBrowser Selection Reference")
  173. /*
  174. PrintCenter callback routines for printer browser modules.
  175. */
  176. typedef CALLBACK_API_C( OSStatus , PMPrBrowserGetLookupSpecProcPtr )(PMPrBrowserRef ref, UInt32 specIndex, CFDictionaryRef *lookupSpec);
  177. typedef CALLBACK_API_C( OSStatus , PMPrBrowserSelectionStatusProcPtr )(PMPrBrowserRef ref, Boolean selected, Boolean addNow);
  178. typedef CALLBACK_API_C( OSStatus , PMPrBrowserSyncRequestProcPtr )(PMPrBrowserRef ref);
  179. /*
  180. Callback parameter block.
  181. */
  182. struct PMPrBrowserCallbacks {
  183. CFIndex version; /* Version number; always set to kPMPrBrowserAPIVersion. */
  184. PMPrBrowserGetLookupSpecProcPtr getLookupSpec;
  185. PMPrBrowserSyncRequestProcPtr syncRequest;
  186. PMPrBrowserSelectionStatusProcPtr selStatus;
  187. };
  188. typedef struct PMPrBrowserCallbacks PMPrBrowserCallbacks;
  189. typedef PMPrBrowserCallbacks * PMPrBrowserCallbacksPtr;
  190. /*
  191. Required entry points for printer browser modules...
  192. */
  193. typedef CALLBACK_API_C( UInt32 , PMPrBrowserAPIVersionProcPtr )(void);
  194. typedef CALLBACK_API_C( OSStatus , PMPrBrowserGetSelectedPrintersProcPtr )(PMPrBrowserContext context, CFArrayRef *printers);
  195. typedef CALLBACK_API_C( OSStatus , PMPrBrowserInitializeProcPtr )(PMPrBrowserContext context, PMPrBrowserRef ref, PMPrBrowserCallbacks *callbacks, ControlRef pbUserPaneCtlHdl, UInt32 numLookupSpecs);
  196. typedef CALLBACK_API_C( OSStatus , PMPrBrowserPrologueProcPtr )(PMPrBrowserContext *context, PMPrBrowserFlags prologueFlags, CFStringRef *title, UInt32 *minH, UInt32 *minV, UInt32 *maxH, UInt32 *maxV);
  197. typedef CALLBACK_API_C( OSStatus , PMPrBrowserResizeProcPtr )(PMPrBrowserContext context, const Rect *frameRect);
  198. typedef CALLBACK_API_C( OSStatus , PMPrBrowserSyncProcPtr )(PMPrBrowserContext context);
  199. typedef CALLBACK_API_C( OSStatus , PMPrBrowserTerminateProcPtr )(PMPrBrowserContext context, OSStatus status);
  200. typedef CALLBACK_API_C( OSStatus , PMPrBrowserWorksetPrintersProcPtr )(PMPrBrowserContext context, CFArrayRef printers);
  201. typedef CALLBACK_API_C( SInt32 , PMCOMQueryInterfaceProcPtr )(void *thisPointer, CFUUIDBytes iid, void **ppv);
  202. typedef CALLBACK_API_C( UInt32 , PMCOMAddRefProcPtr )(void * thisPointer);
  203. typedef CALLBACK_API_C( UInt32 , PMCOMReleaseProcPtr )(void * thisPointer);
  204. /*
  205. Same as IUnknownVTbl from CFPluginCOM.h, but we don't want to drag in that header
  206. because it defines many Windows types that could collide with other definitions
  207. */
  208. struct PMIUnknownVTbl {
  209. void * _reserved;
  210. PMCOMQueryInterfaceProcPtr QueryInterface;
  211. PMCOMAddRefProcPtr AddRef;
  212. PMCOMReleaseProcPtr Release;
  213. };
  214. typedef struct PMIUnknownVTbl PMIUnknownVTbl;
  215. /*
  216. Define the Interface structures returned by Factories.
  217. PMInterfaceAPIVersion Interface...
  218. */
  219. struct PMInterfaceAPIVersion {
  220. PMIUnknownVTbl u; /* Supplies COM compatibility; required of all CFPlugIns. */
  221. PMPrBrowserAPIVersionProcPtr apiVersion;
  222. };
  223. typedef struct PMInterfaceAPIVersion PMInterfaceAPIVersion;
  224. typedef PMInterfaceAPIVersion * PMInterfaceAPIVersionPtr;
  225. /*
  226. PMInterfacePrBrowser Interface...
  227. */
  228. struct PMInterfacePrBrowser {
  229. PMIUnknownVTbl u; /* Supplies COM compatibility; required of all CFPlugIns. */
  230. /*Required entry points.*/
  231. PMPrBrowserGetSelectedPrintersProcPtr getSelectedPrinters;
  232. PMPrBrowserInitializeProcPtr initialize;
  233. PMPrBrowserPrologueProcPtr prologue;
  234. PMPrBrowserResizeProcPtr resize;
  235. PMPrBrowserSyncProcPtr sync;
  236. PMPrBrowserTerminateProcPtr terminate;
  237. PMPrBrowserWorksetPrintersProcPtr worksetPrinters;
  238. };
  239. typedef struct PMInterfacePrBrowser PMInterfacePrBrowser;
  240. typedef PMInterfacePrBrowser * PMInterfacePrBrowserPtr;
  241. #if PRAGMA_STRUCT_ALIGN
  242. #pragma options align=reset
  243. #elif PRAGMA_STRUCT_PACKPUSH
  244. #pragma pack(pop)
  245. #elif PRAGMA_STRUCT_PACK
  246. #pragma pack()
  247. #endif
  248. #ifdef PRAGMA_IMPORT_OFF
  249. #pragma import off
  250. #elif PRAGMA_IMPORT
  251. #pragma import reset
  252. #endif
  253. #ifdef __cplusplus
  254. }
  255. #endif