HTMLRendering.h
上传用户:xjjlds
上传日期:2015-12-05
资源大小:22823k
文件大小:15k
源码类别:

多媒体编程

开发平台:

Visual C++

  1. /*
  2.      File:       HTMLRendering.h
  3.  
  4.      Contains:   HTML Rendering Library Interfaces.
  5.  
  6.      Version:    Technology: 1.0
  7.                  Release:    QuickTime 6.0.2
  8.  
  9.      Copyright:  (c) 1999-2001 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:      For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __HTMLRENDERING__
  18. #define __HTMLRENDERING__
  19. #ifndef __MACTYPES__
  20. #include "MacTypes.h"
  21. #endif
  22. #ifndef __QUICKDRAW__
  23. #include "Quickdraw.h"
  24. #endif
  25. #ifndef __EVENTS__
  26. #include "Events.h"
  27. #endif
  28. #ifndef __FILES__
  29. #include "Files.h"
  30. #endif
  31. #ifndef __CODEFRAGMENTS__
  32. #include "CodeFragments.h"
  33. #endif
  34. #if PRAGMA_ONCE
  35. #pragma once
  36. #endif
  37. #ifdef __cplusplus
  38. extern "C" {
  39. #endif
  40. #if PRAGMA_IMPORT
  41. #pragma import on
  42. #endif
  43. #if PRAGMA_STRUCT_ALIGN
  44.     #pragma options align=mac68k
  45. #elif PRAGMA_STRUCT_PACKPUSH
  46.     #pragma pack(push, 2)
  47. #elif PRAGMA_STRUCT_PACK
  48.     #pragma pack(2)
  49. #endif
  50. typedef struct OpaqueHRReference*       HRReference;
  51. #if CALL_NOT_IN_CARBON
  52. EXTERN_API( OSStatus )
  53. HRGetHTMLRenderingLibVersion    (NumVersion *           returnVers);
  54. #endif  /* CALL_NOT_IN_CARBON */
  55. #if TARGET_RT_MAC_CFM
  56. #if CALL_NOT_IN_CARBON
  57. #ifdef __cplusplus
  58.     inline pascal Boolean HRHTMLRenderingLibAvailable() { return ((HRGetHTMLRenderingLibVersion != (void*)kUnresolvedCFragSymbolAddress) ); }
  59. #else
  60.     #define HRHTMLRenderingLibAvailable()   ((HRGetHTMLRenderingLibVersion != (void*)kUnresolvedCFragSymbolAddress) )
  61. #endif
  62. #endif
  63. #elif TARGET_RT_MAC_MACHO
  64. /* HTML Rendering is currently not available on OS X */
  65. #if CALL_NOT_IN_CARBON
  66. #ifdef __cplusplus
  67.     inline pascal Boolean HRHTMLRenderingLibAvailable() { return false; }
  68. #else
  69.     #define HRHTMLRenderingLibAvailable()   (false)
  70. #endif
  71. #endif
  72. #endif  /*  */
  73. enum {
  74.     kHRRendererHTML32Type       = FOUR_CHAR_CODE('ht32')        /* HTML 3.2 */
  75. };
  76. #if CALL_NOT_IN_CARBON
  77. EXTERN_API( OSStatus )
  78. HRNewReference                  (HRReference *          hrRef,
  79.                                  OSType                 rendererType,
  80.                                  GrafPtr                grafPtr);
  81. EXTERN_API( OSStatus )
  82. HRDisposeReference              (HRReference            hrRef);
  83. EXTERN_API( SInt32 )
  84. HRFreeMemory                    (Size                   inBytesNeeded);
  85. /* System level notifications */
  86. EXTERN_API( void )
  87. HRScreenConfigurationChanged    (void);
  88. EXTERN_API( Boolean )
  89. HRIsHREvent                     (const EventRecord *    eventRecord);
  90. /* Drawing */
  91. EXTERN_API( OSStatus )
  92. HRSetGrafPtr                    (HRReference            hrRef,
  93.                                  GrafPtr                grafPtr);
  94. EXTERN_API( OSStatus )
  95. HRActivate                      (HRReference            hrRef);
  96. EXTERN_API( OSStatus )
  97. HRDeactivate                    (HRReference            hrRef);
  98. EXTERN_API( OSStatus )
  99. HRDraw                          (HRReference            hrRef,
  100.                                  RgnHandle              updateRgnH);
  101. EXTERN_API( OSStatus )
  102. HRSetRenderingRect              (HRReference            hrRef,
  103.                                  const Rect *           renderingRect);
  104. EXTERN_API( OSStatus )
  105. HRGetRenderedImageSize          (HRReference            hrRef,
  106.                                  Point *                renderingSize);
  107. EXTERN_API( OSStatus )
  108. HRScrollToLocation              (HRReference            hrRef,
  109.                                  Point *                location);
  110. EXTERN_API( OSStatus )
  111. HRForceQuickdraw                (HRReference            hrRef,
  112.                                  Boolean                forceQuickdraw);
  113. #endif  /* CALL_NOT_IN_CARBON */
  114. typedef SInt16 HRScrollbarState;
  115. enum {
  116.     eHRScrollbarOn              = 0,
  117.     eHRScrollbarOff             = 1,
  118.     eHRScrollbarAuto            = 2
  119. };
  120. #if CALL_NOT_IN_CARBON
  121. EXTERN_API( OSStatus )
  122. HRSetScrollbarState             (HRReference            hrRef,
  123.                                  HRScrollbarState       hScrollbarState,
  124.                                  HRScrollbarState       vScrollbarState);
  125. EXTERN_API( OSStatus )
  126. HRSetDrawBorder                 (HRReference            hrRef,
  127.                                  Boolean                drawBorder);
  128. EXTERN_API( OSStatus )
  129. HRSetGrowboxCutout              (HRReference            hrRef,
  130.                                  Boolean                allowCutout);
  131. /* Navigation */
  132. EXTERN_API( OSStatus )
  133. HRGoToFile                      (HRReference            hrRef,
  134.                                  const FSSpec *         fsspec,
  135.                                  Boolean                addToHistory,
  136.                                  Boolean                forceRefresh);
  137. EXTERN_API( OSStatus )
  138. HRGoToURL                       (HRReference            hrRef,
  139.                                  const char *           url,
  140.                                  Boolean                addToHistory,
  141.                                  Boolean                forceRefresh);
  142. EXTERN_API( OSStatus )
  143. HRGoToAnchor                    (HRReference            hrRef,
  144.                                  const char *           anchorName);
  145. EXTERN_API( OSStatus )
  146. HRGoToPtr                       (HRReference            hrRef,
  147.                                  char *                 buffer,
  148.                                  UInt32                 bufferSize,
  149.                                  Boolean                addToHistory,
  150.                                  Boolean                forceRefresh);
  151. /* Accessors */
  152. /* either file url or url of <base> tag */
  153. EXTERN_API( OSStatus )
  154. HRGetRootURL                    (HRReference            hrRef,
  155.                                  Handle                 rootURLH);
  156. /* url of <base> tag */
  157. EXTERN_API( OSStatus )
  158. HRGetBaseURL                    (HRReference            hrRef,
  159.                                  Handle                 baseURLH);
  160. /* file url */
  161. EXTERN_API( OSStatus )
  162. HRGetHTMLURL                    (HRReference            hrRef,
  163.                                  Handle                 HTMLURLH);
  164. EXTERN_API( OSStatus )
  165. HRGetTitle                      (HRReference            hrRef,
  166.                                  StringPtr              title);
  167. EXTERN_API( OSStatus )
  168. HRGetHTMLFile                   (HRReference            hrRef,
  169.                                  FSSpec *               fsspec);
  170. /* Utilities */
  171. EXTERN_API( OSStatus )
  172. HRUtilCreateFullURL             (const char *           rootURL,
  173.                                  const char *           linkURL,
  174.                                  Handle                 fullURLH);
  175. EXTERN_API( OSStatus )
  176. HRUtilGetFSSpecFromURL          (const char *           rootURL,
  177.                                  const char *           linkURL,
  178.                                  FSSpec *               destSpec);
  179. /* urlHandle should be valid on input */
  180. EXTERN_API( OSStatus )
  181. HRUtilGetURLFromFSSpec          (const FSSpec *         fsspec,
  182.                                  Handle                 urlHandle);
  183. /*
  184.     Visited links
  185.     If you register a function here, it will be called to determine
  186.     whether or not the given URL has been visited. It should return
  187.     true if the URL has been visited.
  188.     
  189.     In addition to the URLs that the application may add to the list
  190.     of visited links, it should also add URLs that the user clicks
  191.     on. These URLs can be caught by the "add URL to history" callback
  192.     below.
  193.  */
  194. #endif  /* CALL_NOT_IN_CARBON */
  195. typedef CALLBACK_API( Boolean , HRWasURLVisitedProcPtr )(const char *url, void *refCon);
  196. typedef STACK_UPP_TYPE(HRWasURLVisitedProcPtr)                  HRWasURLVisitedUPP;
  197. #if CALL_NOT_IN_CARBON
  198. EXTERN_API( void )
  199. HRRegisterWasURLVisitedUPP      (HRWasURLVisitedUPP     inWasURLVisitedUPP,
  200.                                  HRReference            hrRef,
  201.                                  void *                 inRefCon);
  202. EXTERN_API( void )
  203. HRUnregisterWasURLVisitedUPP    (HRReference            hrRef);
  204. /*
  205.     New URL
  206.     If you register a function here, it will be called every time
  207.     the renderer is going to display a new URL. A few examples of how
  208.     you might use this include...
  209.     
  210.         (a) maintaining a history of URLs
  211.         (b) maintainging a list of visited links
  212.         (c) setting a window title based on the new URL
  213. */
  214. #endif  /* CALL_NOT_IN_CARBON */
  215. typedef CALLBACK_API( OSStatus , HRNewURLProcPtr )(const char *url, const char *targetFrame, Boolean addToHistory, void *refCon);
  216. typedef STACK_UPP_TYPE(HRNewURLProcPtr)                         HRNewURLUPP;
  217. #if CALL_NOT_IN_CARBON
  218. EXTERN_API( void )
  219. HRRegisterNewURLUPP             (HRNewURLUPP            inNewURLUPP,
  220.                                  HRReference            hrRef,
  221.                                  void *                 inRefCon);
  222. EXTERN_API( void )
  223. HRUnregisterNewURLUPP           (HRReference            hrRef);
  224. /*
  225.     URL to FSSpec function
  226.     If you register a function here, it will be called every time
  227.     the renderer is going to locate a file. The function will be
  228.     passed an enum indicating the type of file being asked for.
  229.  */
  230. #endif  /* CALL_NOT_IN_CARBON */
  231. typedef UInt16 URLSourceType;
  232. enum {
  233.     kHRLookingForHTMLSource     = 1,
  234.     kHRLookingForImage          = 2,
  235.     kHRLookingForEmbedded       = 3,
  236.     kHRLookingForImageMap       = 4,
  237.     kHRLookingForFrame          = 5
  238. };
  239. typedef CALLBACK_API( OSStatus , HRURLToFSSpecProcPtr )(const char *rootURL, const char *linkURL, FSSpec *fsspec, URLSourceType urlSourceType, void *refCon);
  240. typedef STACK_UPP_TYPE(HRURLToFSSpecProcPtr)                    HRURLToFSSpecUPP;
  241. #if CALL_NOT_IN_CARBON
  242. EXTERN_API( void )
  243. HRRegisterURLToFSSpecUPP        (HRURLToFSSpecUPP       inURLToFSSpecUPP,
  244.                                  HRReference            hrRef,
  245.                                  void *                 inRefCon);
  246. EXTERN_API( void )
  247. HRUnregisterURLToFSSpecUPP      (HRReference            hrRef);
  248. #endif  /* CALL_NOT_IN_CARBON */
  249. #if OPAQUE_UPP_TYPES
  250. #if CALL_NOT_IN_CARBON
  251.     EXTERN_API(HRWasURLVisitedUPP)
  252.     NewHRWasURLVisitedUPP          (HRWasURLVisitedProcPtr  userRoutine);
  253.     EXTERN_API(HRNewURLUPP)
  254.     NewHRNewURLUPP                 (HRNewURLProcPtr         userRoutine);
  255.     EXTERN_API(HRURLToFSSpecUPP)
  256.     NewHRURLToFSSpecUPP            (HRURLToFSSpecProcPtr    userRoutine);
  257.     EXTERN_API(void)
  258.     DisposeHRWasURLVisitedUPP      (HRWasURLVisitedUPP      userUPP);
  259.     EXTERN_API(void)
  260.     DisposeHRNewURLUPP             (HRNewURLUPP             userUPP);
  261.     EXTERN_API(void)
  262.     DisposeHRURLToFSSpecUPP        (HRURLToFSSpecUPP        userUPP);
  263.     EXTERN_API(Boolean)
  264.     InvokeHRWasURLVisitedUPP       (const char *            url,
  265.                                     void *                  refCon,
  266.                                     HRWasURLVisitedUPP      userUPP);
  267.     EXTERN_API(OSStatus)
  268.     InvokeHRNewURLUPP              (const char *            url,
  269.                                     const char *            targetFrame,
  270.                                     Boolean                 addToHistory,
  271.                                     void *                  refCon,
  272.                                     HRNewURLUPP             userUPP);
  273.     EXTERN_API(OSStatus)
  274.     InvokeHRURLToFSSpecUPP         (const char *            rootURL,
  275.                                     const char *            linkURL,
  276.                                     FSSpec *                fsspec,
  277.                                     URLSourceType           urlSourceType,
  278.                                     void *                  refCon,
  279.                                     HRURLToFSSpecUPP        userUPP);
  280. #endif  /* CALL_NOT_IN_CARBON */
  281. #else
  282.     enum { uppHRWasURLVisitedProcInfo = 0x000003D0 };               /* pascal 1_byte Func(4_bytes, 4_bytes) */
  283.     enum { uppHRNewURLProcInfo = 0x000037F0 };                      /* pascal 4_bytes Func(4_bytes, 4_bytes, 1_byte, 4_bytes) */
  284.     enum { uppHRURLToFSSpecProcInfo = 0x0000EFF0 };                 /* pascal 4_bytes Func(4_bytes, 4_bytes, 4_bytes, 2_bytes, 4_bytes) */
  285.     #define NewHRWasURLVisitedUPP(userRoutine)                      (HRWasURLVisitedUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppHRWasURLVisitedProcInfo, GetCurrentArchitecture())
  286.     #define NewHRNewURLUPP(userRoutine)                             (HRNewURLUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppHRNewURLProcInfo, GetCurrentArchitecture())
  287.     #define NewHRURLToFSSpecUPP(userRoutine)                        (HRURLToFSSpecUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppHRURLToFSSpecProcInfo, GetCurrentArchitecture())
  288.     #define DisposeHRWasURLVisitedUPP(userUPP)                      DisposeRoutineDescriptor(userUPP)
  289.     #define DisposeHRNewURLUPP(userUPP)                             DisposeRoutineDescriptor(userUPP)
  290.     #define DisposeHRURLToFSSpecUPP(userUPP)                        DisposeRoutineDescriptor(userUPP)
  291.     #define InvokeHRWasURLVisitedUPP(url, refCon, userUPP)          (Boolean)CALL_TWO_PARAMETER_UPP((userUPP), uppHRWasURLVisitedProcInfo, (url), (refCon))
  292.     #define InvokeHRNewURLUPP(url, targetFrame, addToHistory, refCon, userUPP)  (OSStatus)CALL_FOUR_PARAMETER_UPP((userUPP), uppHRNewURLProcInfo, (url), (targetFrame), (addToHistory), (refCon))
  293.     #define InvokeHRURLToFSSpecUPP(rootURL, linkURL, fsspec, urlSourceType, refCon, userUPP)  (OSStatus)CALL_FIVE_PARAMETER_UPP((userUPP), uppHRURLToFSSpecProcInfo, (rootURL), (linkURL), (fsspec), (urlSourceType), (refCon))
  294. #endif
  295. /* support for pre-Carbon UPP routines: NewXXXProc and CallXXXProc */
  296. #define NewHRWasURLVisitedProc(userRoutine)                     NewHRWasURLVisitedUPP(userRoutine)
  297. #define NewHRNewURLProc(userRoutine)                            NewHRNewURLUPP(userRoutine)
  298. #define NewHRURLToFSSpecProc(userRoutine)                       NewHRURLToFSSpecUPP(userRoutine)
  299. #define CallHRWasURLVisitedProc(userRoutine, url, refCon)       InvokeHRWasURLVisitedUPP(url, refCon, userRoutine)
  300. #define CallHRNewURLProc(userRoutine, url, targetFrame, addToHistory, refCon) InvokeHRNewURLUPP(url, targetFrame, addToHistory, refCon, userRoutine)
  301. #define CallHRURLToFSSpecProc(userRoutine, rootURL, linkURL, fsspec, urlSourceType, refCon) InvokeHRURLToFSSpecUPP(rootURL, linkURL, fsspec, urlSourceType, refCon, userRoutine)
  302. #if PRAGMA_STRUCT_ALIGN
  303.     #pragma options align=reset
  304. #elif PRAGMA_STRUCT_PACKPUSH
  305.     #pragma pack(pop)
  306. #elif PRAGMA_STRUCT_PACK
  307.     #pragma pack()
  308. #endif
  309. #ifdef PRAGMA_IMPORT_OFF
  310. #pragma import off
  311. #elif PRAGMA_IMPORT
  312. #pragma import reset
  313. #endif
  314. #ifdef __cplusplus
  315. }
  316. #endif
  317. #endif /* __HTMLRENDERING__ */