WebCore:
[WebKit-https.git] / WebKitLibraries / WebKitSystemInterface.h
1 /*      
2     WebKitSystemInterface.h
3     Copyright (C) 2005, 2006, 2007 Apple Inc. All rights reserved.    
4
5     Public header file.
6 */
7
8 #import <Cocoa/Cocoa.h>
9 #import <Carbon/Carbon.h>
10
11 @class QTMovie;
12 @class QTMovieView;
13
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17
18 typedef enum {
19     WKCertificateParseResultSucceeded  = 0,
20     WKCertificateParseResultFailed     = 1,
21     WKCertificateParseResultPKCS7      = 2,
22 } WKCertificateParseResult;
23
24 CFStringRef WKCopyCFLocalizationPreferredName(CFStringRef localization);
25 CFStringRef WKSignedPublicKeyAndChallengeString(unsigned keySize, CFStringRef challenge, CFStringRef keyDescription);
26 WKCertificateParseResult WKAddCertificatesToKeychainFromData(const void *bytes, unsigned length);
27
28 NSString *WKGetPreferredExtensionForMIMEType(NSString *type);
29 NSArray *WKGetExtensionsForMIMEType(NSString *type);
30 NSString *WKGetMIMETypeForExtension(NSString *extension);
31
32 NSDate *WKGetNSURLResponseLastModifiedDate(NSURLResponse *response);
33 NSTimeInterval WKGetNSURLResponseFreshnessLifetime(NSURLResponse *response);
34 NSTimeInterval WKGetNSURLResponseCalculatedExpiration(NSURLResponse *response);
35 BOOL WKGetNSURLResponseMustRevalidate(NSURLResponse *response);
36
37 CFStringEncoding WKGetWebDefaultCFStringEncoding(void);
38
39 float WKSecondsSinceLastInputEvent(void);
40 CFStringRef WKPreferRGB32Key(void);
41
42 void WKSetNSURLConnectionDefersCallbacks(NSURLConnection *connection, BOOL defers);
43 float WKSecondsSinceLastInputEvent(void);
44
45 void WKShowKeyAndMain(void);
46 #ifndef __LP64__
47 OSStatus WKSyncWindowWithCGAfterMove(WindowRef);
48 unsigned WKCarbonWindowMask(void);
49 void *WKGetNativeWindowFromWindowRef(WindowRef);
50 OSType WKCarbonWindowPropertyCreator(void);
51 OSType WKCarbonWindowPropertyTag(void);
52 #endif
53
54 typedef id WKNSURLConnectionDelegateProxyPtr;
55
56 WKNSURLConnectionDelegateProxyPtr WKCreateNSURLConnectionDelegateProxy(void);
57
58 void WKDisableCGDeferredUpdates(void);
59
60 Class WKNSURLProtocolClassForReqest(NSURLRequest *request);
61 void WKSetNSURLRequestShouldContentSniff(NSMutableURLRequest *request, BOOL shouldContentSniff);
62
63 unsigned WKGetNSAutoreleasePoolCount(void);
64
65 NSString *WKMouseMovedNotification(void);
66 void WKSetNSWindowShouldPostEventNotifications(NSWindow *window, BOOL post);
67
68 CFTypeID WKGetAXTextMarkerTypeID(void);
69 CFTypeID WKGetAXTextMarkerRangeTypeID(void);
70 CFTypeRef WKCreateAXTextMarker(const void *bytes, size_t len);
71 BOOL WKGetBytesFromAXTextMarker(CFTypeRef textMarker, void *bytes, size_t length);
72 CFTypeRef WKCreateAXTextMarkerRange(CFTypeRef start, CFTypeRef end);
73 CFTypeRef WKCopyAXTextMarkerRangeStart(CFTypeRef range);
74 CFTypeRef WKCopyAXTextMarkerRangeEnd(CFTypeRef range);
75 void WKAccessibilityHandleFocusChanged(void);
76 AXUIElementRef WKCreateAXUIElementRef(id element);
77 void WKUnregisterUniqueIdForElement(id element);
78
79 BOOL WKFontSmoothingModeIsLCD(int mode);
80 void WKSetUpFontCache(size_t s);
81
82 void WKSignalCFReadStreamEnd(CFReadStreamRef stream);
83 void WKSignalCFReadStreamHasBytes(CFReadStreamRef stream);
84 void WKSignalCFReadStreamError(CFReadStreamRef stream, CFStreamError *error);
85
86 CFReadStreamRef WKCreateCustomCFReadStream(void *(*formCreate)(CFReadStreamRef, void *), 
87     void (*formFinalize)(CFReadStreamRef, void *), 
88     Boolean (*formOpen)(CFReadStreamRef, CFStreamError *, Boolean *, void *), 
89     CFIndex (*formRead)(CFReadStreamRef, UInt8 *, CFIndex, CFStreamError *, Boolean *, void *), 
90     Boolean (*formCanRead)(CFReadStreamRef, void *), 
91     void (*formClose)(CFReadStreamRef, void *), 
92     void (*formSchedule)(CFReadStreamRef, CFRunLoopRef, CFStringRef, void *), 
93     void (*formUnschedule)(CFReadStreamRef, CFRunLoopRef, CFStringRef, void *),
94     void *context);
95
96 void WKDrawCapsLockIndicator(CGContextRef, CGRect);
97
98 void WKDrawFocusRing(CGContextRef context, CGColorRef color, int radius);
99     // The CG context's current path is the focus ring's path.
100     // A color of 0 means "use system focus ring color".
101     // A radius of 0 means "use default focus ring radius".
102
103 void WKSetDragImage(NSImage *image, NSPoint offset);
104
105 void WKDrawBezeledTextFieldCell(NSRect, BOOL enabled);
106 void WKDrawTextFieldCellFocusRing(NSTextFieldCell*, NSRect);
107 void WKDrawBezeledTextArea(NSRect, BOOL enabled);
108 void WKPopupMenu(NSMenu*, NSPoint location, float width, NSView*, int selectedItem, NSFont*);
109
110 void WKSendUserChangeNotifications(void);
111 #ifndef __LP64__    
112 BOOL WKConvertNSEventToCarbonEvent(EventRecord *carbonEvent, NSEvent *cocoaEvent);
113 void WKSendKeyEventToTSM(NSEvent *theEvent);
114 void WKCallDrawingNotification(CGrafPtr port, Rect *bounds);
115 #endif
116
117 BOOL WKGetGlyphTransformedAdvances(CGFontRef, NSFont*, CGAffineTransform *m, ATSGlyphRef *glyph, CGSize *advance);
118 CGFontRef WKGetCGFontFromNSFont(NSFont *font);
119 void WKGetFontMetrics(CGFontRef font, int *ascent, int *descent, int *lineGap, unsigned *unitsPerEm);
120 NSFont *WKGetFontInLanguageForRange(NSFont *font, NSString *string, NSRange range);
121 NSFont *WKGetFontInLanguageForCharacter(NSFont *font, UniChar ch);
122 void WKSetCGFontRenderingMode(CGContextRef cgContext, NSFont *font);
123 ATSUFontID WKGetNSFontATSUFontId(NSFont *font);
124 void WKReleaseStyleGroup(void *group);
125 BOOL WKCGContextGetShouldSmoothFonts(CGContextRef cgContext);
126
127 void WKSetPatternBaseCTM(CGContextRef, CGAffineTransform);
128 void WKSetPatternPhaseInUserSpace(CGContextRef, CGPoint);
129
130 typedef void *WKGlyphVectorRef;
131 OSStatus WKConvertCharToGlyphs(void *styleGroup, const UniChar *characters, unsigned numCharacters, WKGlyphVectorRef glyphs);
132 OSStatus WKGetATSStyleGroup(ATSUStyle fontStyle, void **styleGroup);
133 OSStatus WKInitializeGlyphVector(int count, WKGlyphVectorRef glyphs);
134 void WKClearGlyphVector(WKGlyphVectorRef glyphs);
135
136 int WKGetGlyphVectorNumGlyphs(WKGlyphVectorRef glyphVector);
137 ATSLayoutRecord *WKGetGlyphVectorFirstRecord(WKGlyphVectorRef glyphVector);
138 size_t WKGetGlyphVectorRecordSize(WKGlyphVectorRef glyphVector);
139 ATSGlyphRef WKGetDefaultGlyphForChar(NSFont *font, UniChar c);
140
141 #ifndef __LP64__
142 NSEvent *WKCreateNSEventWithCarbonEvent(EventRef eventRef);
143 NSEvent *WKCreateNSEventWithCarbonMouseMoveEvent(EventRef inEvent, NSWindow *window);
144 NSEvent *WKCreateNSEventWithCarbonClickEvent(EventRef inEvent, WindowRef windowRef);
145 #endif
146
147 CGContextRef WKNSWindowOverrideCGContext(NSWindow *, CGContextRef);
148 void WKNSWindowRestoreCGContext(NSWindow *, CGContextRef);
149
150 void WKNSWindowMakeBottomCornersSquare(NSWindow *);
151
152 BOOL WKSupportsMultipartXMixedReplace(NSMutableURLRequest *request);
153 NSString* WKPathFromFont(NSFont *font);
154
155 BOOL WKCGContextIsBitmapContext(CGContextRef context);
156
157 void WKGetWheelEventDeltas(NSEvent *, float *deltaX, float *deltaY, BOOL *continuous);
158
159 BOOL WKAppVersionCheckLessThan(NSString *, int, double);
160
161 int WKQTMovieDataRate(QTMovie* movie);
162 float WKQTMovieMaxTimeLoaded(QTMovie* movie);
163 void WKQTMovieViewSetDrawSynchronously(QTMovieView* view, BOOL sync);
164
165 CFStringRef WKCopyFoundationCacheDirectory(void);
166
167 #ifdef __cplusplus
168 }
169 #endif