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