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.

274 lines
7.9 KiB

  1. /*
  2. File: FontPanel.h
  3. Contains: Carbon Font Panel package Interfaces.
  4. Version: QuickTime 7.3
  5. Copyright: (c) 2007 (C) 2002 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 __FONTPANEL__
  11. #define __FONTPANEL__
  12. #ifndef __ATSTYPES__
  13. #include <ATSTypes.h>
  14. #endif
  15. #ifndef __CARBONEVENTS__
  16. #include <CarbonEvents.h>
  17. #endif
  18. #ifndef __MACERRORS__
  19. #include <MacErrors.h>
  20. #endif
  21. #ifndef __MACTYPES__
  22. #include <MacTypes.h>
  23. #endif
  24. #ifndef __QUICKDRAW__
  25. #include <Quickdraw.h>
  26. #endif
  27. #if PRAGMA_ONCE
  28. #pragma once
  29. #endif
  30. #ifdef __cplusplus
  31. extern "C" {
  32. #endif
  33. #if PRAGMA_IMPORT
  34. #pragma import on
  35. #endif
  36. #if PRAGMA_STRUCT_ALIGN
  37. #pragma options align=mac68k
  38. #elif PRAGMA_STRUCT_PACKPUSH
  39. #pragma pack(push, 2)
  40. #elif PRAGMA_STRUCT_PACK
  41. #pragma pack(2)
  42. #endif
  43. /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  44. Font Panel-Related Events
  45. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
  46. /*
  47. * Discussion:
  48. * Event classes
  49. */
  50. enum {
  51. /*
  52. * Events related to font selection or handling.
  53. */
  54. kEventClassFont = FOUR_CHAR_CODE('font')
  55. };
  56. /*
  57. * Summary:
  58. * Common command IDs
  59. */
  60. enum {
  61. /*
  62. * The state of the Font Panel should be toggled, displaying it or
  63. * hiding it as necessary. If the user closes the Font Panel directly
  64. * from the window, the application will receive a
  65. * kEventFontPanelClosed event.
  66. */
  67. kHICommandShowHideFontPanel = FOUR_CHAR_CODE('shfp')
  68. };
  69. /* Font Events */
  70. /*
  71. * Summary:
  72. * Font events (kEventClassFont)
  73. *
  74. * Discussion:
  75. * When the user closes the Font Panel, a kEventWindowClosed event
  76. * will be detected by the Carbon event handler installed by the
  77. * system. The system then notifies the application that the Font
  78. * Panel has closed by posting a Carbon Event Manager event. This
  79. * allows the application to update any menu items or other controls
  80. * whose state may have to change because the Font Panel has closed.
  81. * kEventWindowClosed has no parameters. When the user selects an
  82. * item in the Font Panel, the system will send a
  83. * kEventFontSelection event to the event target specified when the
  84. * application called SetFontPanelInfo(). kEventFontSelection will
  85. * contain parameters reflecting the current Font Panel selection in
  86. * all supported formats. Font events are available after Mac OS X
  87. * 10.2 in the Carbon framework.
  88. */
  89. enum {
  90. /*
  91. * The Font Panel has been closed. The application should update its
  92. * corresponding UI element (e.g., a menu item) accordingly.
  93. */
  94. kEventFontPanelClosed = 1,
  95. /*
  96. * The user has specified font settings in the Font Panel. The
  97. * application can obtain these settings from the event, in which
  98. * they are stored as parameters. Not all parameters are guaranteed
  99. * to be present; the application should check for all those which it
  100. * recognizes and apply the ones found as appropriate to the target
  101. * text.
  102. */
  103. kEventFontSelection = 2
  104. };
  105. /*
  106. Parameters for font events:
  107. kEventFontPanelClosed
  108. None.
  109. kEventFontSelection
  110. --> kEventParamATSUFontID typeATSUFontID
  111. --> kEventParamATSUFontSize typeATSUSize
  112. --> kEventParamFMFontFamily typeFMFontFamily
  113. --> kEventParamFMFontSize typeFMFontSize
  114. --> kEventParamFontColor typeFontColor
  115. */
  116. enum {
  117. typeATSUFontID = typeUInt32, /* ATSUI font ID.*/
  118. typeATSUSize = typeFixed, /* ATSUI font size.*/
  119. typeFMFontFamily = typeSInt16, /* Font family reference.*/
  120. typeFMFontStyle = typeSInt16, /* Quickdraw font style*/
  121. typeFMFontSize = typeSInt16, /* Integer font size.*/
  122. typeFontColor = typeRGBColor, /* Font color spec (optional).*/
  123. kEventParamATSUFontID = FOUR_CHAR_CODE('auid'), /* typeATSUFontID*/
  124. kEventParamATSUFontSize = FOUR_CHAR_CODE('ausz'), /* typeATSUSize*/
  125. kEventParamFMFontFamily = FOUR_CHAR_CODE('fmfm'), /* typeFMFontFamily*/
  126. kEventParamFMFontStyle = FOUR_CHAR_CODE('fmst'), /* typeFMFontStyle*/
  127. kEventParamFMFontSize = FOUR_CHAR_CODE('fmsz'), /* typeFMFontSize*/
  128. kEventParamFontColor = FOUR_CHAR_CODE('fclr') /* typeFontColor*/
  129. };
  130. /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  131. Other Font Panel Constants
  132. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
  133. /*
  134. Error codes (Font Panel codes in range [-8880,-8899]).
  135. */
  136. enum {
  137. fontPanelShowErr = -8880, /* Can't display the Font Panel.*/
  138. fontPanelSelectionStyleErr = -8881, /* Bad font selection style info.*/
  139. fontPanelFontSelectionQDStyleVersionErr = -8882 /* Unsupported record version.*/
  140. };
  141. /*
  142. Type of font information passed in SetFontPanelInfo(). If the client is
  143. sending ATSUI style data, it specifies kFontSelectionATSUIType; if it is
  144. sending Quickdraw style data, it specifies kFontSelectionQDType.
  145. */
  146. enum {
  147. kFontSelectionATSUIType = FOUR_CHAR_CODE('astl'), /* Use ATSUIStyle collection.*/
  148. kFontSelectionQDType = FOUR_CHAR_CODE('qstl') /* Use FontSelectionQDStyle record.*/
  149. };
  150. /*
  151. Supported versions of the FontSelectionQDStyle record. Clients should always set
  152. the <version> field to one of these values.
  153. */
  154. enum {
  155. kFontSelectionQDStyleVersionZero = 0
  156. };
  157. /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  158. Font Panel Types
  159. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
  160. /*
  161. Record specifying the font information to be specified in the Font
  162. Panel. This record is used if the client is sending Quickdraw style data
  163. (i.e., it specified kFontSelectionQDType in SetFontPanelInfo()).
  164. */
  165. struct FontSelectionQDStyle {
  166. UInt32 version; /* Version number of struct.*/
  167. FMFontFamilyInstance instance; /* Font instance data.*/
  168. FMFontSize size; /* Size of font in points.*/
  169. Boolean hasColor; /* true if color info supplied.*/
  170. UInt8 reserved; /* Filler byte.*/
  171. RGBColor color; /* Color specification for font.*/
  172. };
  173. typedef struct FontSelectionQDStyle FontSelectionQDStyle;
  174. typedef FontSelectionQDStyle * FontSelectionQDStylePtr;
  175. /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  176. Font Panel Functions
  177. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
  178. /*
  179. * FPIsFontPanelVisible()
  180. *
  181. * Availability:
  182. * Non-Carbon CFM: not available
  183. * CarbonLib: not available in CarbonLib 1.x
  184. * Mac OS X: in version 10.2 and later
  185. */
  186. EXTERN_API_C( Boolean )
  187. FPIsFontPanelVisible(void);
  188. /*
  189. * FPShowHideFontPanel()
  190. *
  191. * Availability:
  192. * Non-Carbon CFM: not available
  193. * CarbonLib: not available in CarbonLib 1.x
  194. * Mac OS X: in version 10.2 and later
  195. */
  196. EXTERN_API_C( OSStatus )
  197. FPShowHideFontPanel(void);
  198. /*
  199. * SetFontInfoForSelection()
  200. *
  201. * Availability:
  202. * Non-Carbon CFM: not available
  203. * CarbonLib: not available in CarbonLib 1.x
  204. * Mac OS X: in version 10.2 and later
  205. */
  206. EXTERN_API_C( OSStatus )
  207. SetFontInfoForSelection(
  208. OSType iStyleType,
  209. UInt32 iNumStyles,
  210. void * iStyles,
  211. HIObjectRef iFPEventTarget);
  212. #if PRAGMA_STRUCT_ALIGN
  213. #pragma options align=reset
  214. #elif PRAGMA_STRUCT_PACKPUSH
  215. #pragma pack(pop)
  216. #elif PRAGMA_STRUCT_PACK
  217. #pragma pack()
  218. #endif
  219. #ifdef PRAGMA_IMPORT_OFF
  220. #pragma import off
  221. #elif PRAGMA_IMPORT
  222. #pragma import reset
  223. #endif
  224. #ifdef __cplusplus
  225. }
  226. #endif
  227. #endif /* __FONTPANEL__ */