1 /* 2 * Copyright 2006, 2007, 2008 Apple Inc. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. 9 * 2. Redistributions in binary form must reproduce the above copyright 10 * notice, this list of conditions and the following disclaimer in the 11 * documentation and/or other materials provided with the distribution. 12 * 13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 */ 25 26 #ifndef WebCoreSystemInterface_h 27 #define WebCoreSystemInterface_h 28 29 #include <ApplicationServices/ApplicationServices.h> 30 #include <objc/objc.h> 31 32 typedef struct _NSRange NSRange; 33 34 #ifdef NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES 35 typedef struct CGPoint NSPoint; 36 typedef struct CGRect NSRect; 37 #else 38 typedef struct _NSPoint NSPoint; 39 typedef struct _NSRect NSRect; 40 #endif 41 42 #ifdef __OBJC__ 43 @class NSArray; 44 @class NSButtonCell; 45 @class NSData; 46 @class NSDate; 47 @class NSEvent; 48 @class NSFont; 49 @class NSImage; 50 @class NSMenu; 51 @class NSMutableURLRequest; 52 @class NSString; 53 @class NSTextFieldCell; 54 @class NSURLConnection; 55 @class NSURLRequest; 56 @class NSURLResponse; 57 @class NSView; 58 @class QTMovie; 59 @class QTMovieView; 60 #else 61 typedef struct NSArray NSArray; 62 typedef struct NSButtonCell NSButtonCell; 63 typedef struct NSData NSData; 64 typedef struct NSDate NSDate; 65 typedef struct NSEvent NSEvent; 66 typedef struct NSFont NSFont; 67 typedef struct NSImage NSImage; 68 typedef struct NSMenu NSMenu; 69 typedef struct NSMutableURLRequest NSMutableURLRequest; 70 typedef struct NSURLRequest NSURLRequest; 71 typedef struct NSString NSString; 72 typedef struct NSTextFieldCell NSTextFieldCell; 73 typedef struct NSURLConnection NSURLConnection; 74 typedef struct NSURLResponse NSURLResponse; 75 typedef struct NSView NSView; 76 typedef struct objc_object *id; 77 typedef struct QTMovie QTMovie; 78 typedef struct QTMovieView QTMovieView; 79 #endif 80 81 #ifdef __cplusplus 82 extern "C" { 83 #endif 84 85 // In alphabetical order. 86 87 extern void (*wkAdvanceDefaultButtonPulseAnimation)(NSButtonCell *); 88 extern BOOL (*wkCGContextGetShouldSmoothFonts)(CGContextRef); 89 extern CFReadStreamRef (*wkCreateCustomCFReadStream)(void *(*formCreate)(CFReadStreamRef, void *), 90 void (*formFinalize)(CFReadStreamRef, void *), 91 Boolean (*formOpen)(CFReadStreamRef, CFStreamError *, Boolean *, void *), 92 CFIndex (*formRead)(CFReadStreamRef, UInt8 *, CFIndex, CFStreamError *, Boolean *, void *), 93 Boolean (*formCanRead)(CFReadStreamRef, void *), 94 void (*formClose)(CFReadStreamRef, void *), 95 void (*formSchedule)(CFReadStreamRef, CFRunLoopRef, CFStringRef, void *), 96 void (*formUnschedule)(CFReadStreamRef, CFRunLoopRef, CFStringRef, void *), 97 void *context); 98 extern id (*wkCreateNSURLConnectionDelegateProxy)(void); 99 extern void (*wkDrawBezeledTextFieldCell)(NSRect, BOOL enabled); 100 extern void (*wkDrawTextFieldCellFocusRing)(NSTextFieldCell*, NSRect); 101 extern void (*wkDrawCapsLockIndicator)(CGContextRef, CGRect); 102 extern void (*wkDrawBezeledTextArea)(NSRect, BOOL enabled); 103 extern void (*wkDrawFocusRing)(CGContextRef, CGColorRef, int radius); 104 extern NSFont* (*wkGetFontInLanguageForRange)(NSFont*, NSString*, NSRange); 105 extern NSFont* (*wkGetFontInLanguageForCharacter)(NSFont*, UniChar); 106 extern BOOL (*wkGetGlyphTransformedAdvances)(CGFontRef, NSFont*, CGAffineTransform*, ATSGlyphRef*, CGSize* advance); 107 extern void (*wkDrawMediaSliderTrack)(int themeStyle, CGContextRef context, CGRect rect, float timeLoaded, float currentTime, 108 float duration, unsigned state); 109 extern void (*wkDrawMediaUIPart)(int part, int themeStyle, CGContextRef context, CGRect rect, unsigned state); 110 extern NSString* (*wkGetPreferredExtensionForMIMEType)(NSString*); 111 extern NSArray* (*wkGetExtensionsForMIMEType)(NSString*); 112 extern NSString* (*wkGetMIMETypeForExtension)(NSString*); 113 extern ATSUFontID (*wkGetNSFontATSUFontId)(NSFont*); 114 extern double (*wkGetNSURLResponseCalculatedExpiration)(NSURLResponse *response); 115 extern NSDate *(*wkGetNSURLResponseLastModifiedDate)(NSURLResponse *response); 116 extern BOOL (*wkGetNSURLResponseMustRevalidate)(NSURLResponse *response); 117 extern void (*wkGetWheelEventDeltas)(NSEvent*, float* deltaX, float* deltaY, BOOL* continuous); 118 extern BOOL (*wkHitTestMediaUIPart)(int part, int themeStyle, CGRect bounds, CGPoint point); 119 extern void (*wkMeasureMediaUIPart)(int part, int themeStyle, CGRect *bounds, CGSize *naturalSize); 120 extern void (*wkPopupMenu)(NSMenu*, NSPoint location, float width, NSView*, int selectedItem, NSFont*); 121 extern unsigned (*wkQTIncludeOnlyModernMediaFileTypes)(void); 122 extern int (*wkQTMovieDataRate)(QTMovie*); 123 extern float (*wkQTMovieMaxTimeLoaded)(QTMovie*); 124 extern NSString *(*wkQTMovieMaxTimeLoadedChangeNotification)(void); 125 extern float (*wkQTMovieMaxTimeSeekable)(QTMovie*); 126 extern int (*wkQTMovieGetType)(QTMovie* movie); 127 extern void (*wkQTMovieViewSetDrawSynchronously)(QTMovieView*, BOOL); 128 extern void (*wkSetCGFontRenderingMode)(CGContextRef, NSFont*); 129 extern void (*wkSetDragImage)(NSImage*, NSPoint offset); 130 extern void (*wkSetNSURLConnectionDefersCallbacks)(NSURLConnection *, BOOL); 131 extern void (*wkSetNSURLRequestShouldContentSniff)(NSMutableURLRequest *, BOOL); 132 extern void (*wkSetPatternBaseCTM)(CGContextRef, CGAffineTransform); 133 extern void (*wkSetPatternPhaseInUserSpace)(CGContextRef, CGPoint); 134 extern void (*wkSetUpFontCache)(); 135 extern void (*wkSignalCFReadStreamEnd)(CFReadStreamRef stream); 136 extern void (*wkSignalCFReadStreamError)(CFReadStreamRef stream, CFStreamError *error); 137 extern void (*wkSignalCFReadStreamHasBytes)(CFReadStreamRef stream); 138 extern unsigned (*wkInitializeMaximumHTTPConnectionCountPerHost)(unsigned preferredConnectionCount); 139 extern BOOL (*wkIsLatchingWheelEvent)(NSEvent *); 140 141 #ifndef BUILDING_ON_TIGER 142 extern void (*wkGetGlyphsForCharacters)(CGFontRef, const UniChar[], CGGlyph[], size_t); 143 #else 144 #define GLYPH_VECTOR_SIZE (50 * 32) 145 146 extern void (*wkClearGlyphVector)(void* glyphs); 147 extern OSStatus (*wkConvertCharToGlyphs)(void* styleGroup, const UniChar*, unsigned numCharacters, void* glyphs); 148 extern CFStringRef (*wkCopyFullFontName)(CGFontRef font); 149 extern OSStatus (*wkGetATSStyleGroup)(ATSUStyle, void** styleGroup); 150 extern CGFontRef (*wkGetCGFontFromNSFont)(NSFont*); 151 extern void (*wkGetFontMetrics)(CGFontRef, int* ascent, int* descent, int* lineGap, unsigned* unitsPerEm); 152 extern ATSLayoutRecord* (*wkGetGlyphVectorFirstRecord)(void* glyphVector); 153 extern void* wkGetGlyphsForCharacters; 154 extern int (*wkGetGlyphVectorNumGlyphs)(void* glyphVector); 155 extern size_t (*wkGetGlyphVectorRecordSize)(void* glyphVector); 156 extern OSStatus (*wkInitializeGlyphVector)(int count, void* glyphs); 157 extern void (*wkReleaseStyleGroup)(void* group); 158 extern BOOL (*wkSupportsMultipartXMixedReplace)(NSMutableURLRequest *); 159 #endif 160 161 extern BOOL (*wkUseSharedMediaUI)(); 162 163 #ifdef __cplusplus 164 } 165 #endif 166 167 #endif 168