2008-02-28 Mark Rowe <mrowe@apple.com>
[WebKit-https.git] / WebKitLibraries / WebKitSystemInterface.h
1 /*      
2     WebKitSystemInterface.h
3     Copyright (C) 2005, 2006, 2007, 2008 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
35 CFStringEncoding WKGetWebDefaultCFStringEncoding(void);
36
37 float WKSecondsSinceLastInputEvent(void);
38
39 void WKSetMetadataURL(NSString *URLString, NSString *referrer, NSString *path);
40 void WKSetNSURLConnectionDefersCallbacks(NSURLConnection *connection, BOOL defers);
41
42 void WKShowKeyAndMain(void);
43 #ifndef __LP64__
44 OSStatus WKSyncWindowWithCGAfterMove(WindowRef);
45 unsigned WKCarbonWindowMask(void);
46 void *WKGetNativeWindowFromWindowRef(WindowRef);
47 OSType WKCarbonWindowPropertyCreator(void);
48 OSType WKCarbonWindowPropertyTag(void);
49 #endif
50
51 typedef id WKNSURLConnectionDelegateProxyPtr;
52
53 WKNSURLConnectionDelegateProxyPtr WKCreateNSURLConnectionDelegateProxy(void);
54
55 void WKDisableCGDeferredUpdates(void);
56
57 Class WKNSURLProtocolClassForReqest(NSURLRequest *request);
58 void WKSetNSURLRequestShouldContentSniff(NSMutableURLRequest *request, BOOL shouldContentSniff);
59
60 unsigned WKGetNSAutoreleasePoolCount(void);
61
62 NSString *WKMouseMovedNotification(void);
63 void WKSetNSWindowShouldPostEventNotifications(NSWindow *window, BOOL post);
64
65 CFTypeID WKGetAXTextMarkerTypeID(void);
66 CFTypeID WKGetAXTextMarkerRangeTypeID(void);
67 CFTypeRef WKCreateAXTextMarker(const void *bytes, size_t len);
68 BOOL WKGetBytesFromAXTextMarker(CFTypeRef textMarker, void *bytes, size_t length);
69 CFTypeRef WKCreateAXTextMarkerRange(CFTypeRef start, CFTypeRef end);
70 CFTypeRef WKCopyAXTextMarkerRangeStart(CFTypeRef range);
71 CFTypeRef WKCopyAXTextMarkerRangeEnd(CFTypeRef range);
72 void WKAccessibilityHandleFocusChanged(void);
73 AXUIElementRef WKCreateAXUIElementRef(id element);
74 void WKUnregisterUniqueIdForElement(id element);
75
76 BOOL WKFontSmoothingModeIsLCD(int mode);
77 void WKSetUpFontCache(size_t s);
78
79 void WKSignalCFReadStreamEnd(CFReadStreamRef stream);
80 void WKSignalCFReadStreamHasBytes(CFReadStreamRef stream);
81 void WKSignalCFReadStreamError(CFReadStreamRef stream, CFStreamError *error);
82
83 CFReadStreamRef WKCreateCustomCFReadStream(void *(*formCreate)(CFReadStreamRef, void *), 
84     void (*formFinalize)(CFReadStreamRef, void *), 
85     Boolean (*formOpen)(CFReadStreamRef, CFStreamError *, Boolean *, void *), 
86     CFIndex (*formRead)(CFReadStreamRef, UInt8 *, CFIndex, CFStreamError *, Boolean *, void *), 
87     Boolean (*formCanRead)(CFReadStreamRef, void *), 
88     void (*formClose)(CFReadStreamRef, void *), 
89     void (*formSchedule)(CFReadStreamRef, CFRunLoopRef, CFStringRef, void *), 
90     void (*formUnschedule)(CFReadStreamRef, CFRunLoopRef, CFStringRef, void *),
91     void *context);
92
93 void WKDrawCapsLockIndicator(CGContextRef, CGRect);
94
95 void WKDrawFocusRing(CGContextRef context, CGColorRef color, int radius);
96     // The CG context's current path is the focus ring's path.
97     // A color of 0 means "use system focus ring color".
98     // A radius of 0 means "use default focus ring radius".
99
100 void WKSetDragImage(NSImage *image, NSPoint offset);
101
102 void WKDrawBezeledTextFieldCell(NSRect, BOOL enabled);
103 void WKDrawTextFieldCellFocusRing(NSTextFieldCell*, NSRect);
104 void WKDrawBezeledTextArea(NSRect, BOOL enabled);
105 void WKPopupMenu(NSMenu*, NSPoint location, float width, NSView*, int selectedItem, NSFont*);
106
107 void WKSendUserChangeNotifications(void);
108 #ifndef __LP64__
109 BOOL WKConvertNSEventToCarbonEvent(EventRecord *carbonEvent, NSEvent *cocoaEvent);
110 void WKSendKeyEventToTSM(NSEvent *theEvent);
111 void WKCallDrawingNotification(CGrafPtr port, Rect *bounds);
112 #endif
113
114 BOOL WKGetGlyphTransformedAdvances(CGFontRef, NSFont*, CGAffineTransform *m, ATSGlyphRef *glyph, CGSize *advance);
115 CGFontRef WKGetCGFontFromNSFont(NSFont *font);
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 #ifdef BUILDING_ON_TIGER
124 // CGFontGetAscent, CGFontGetDescent, CGFontGetLeading and CGFontGetUnitsPerEm were not available until Leopard
125 void WKGetFontMetrics(CGFontRef font, int *ascent, int *descent, int *lineGap, unsigned *unitsPerEm);
126 #endif
127
128 void WKSetPatternBaseCTM(CGContextRef, CGAffineTransform);
129 void WKSetPatternPhaseInUserSpace(CGContextRef, CGPoint);
130
131 typedef void *WKGlyphVectorRef;
132 OSStatus WKConvertCharToGlyphs(void *styleGroup, const UniChar *characters, unsigned numCharacters, WKGlyphVectorRef glyphs);
133 OSStatus WKGetATSStyleGroup(ATSUStyle fontStyle, void **styleGroup);
134 OSStatus WKInitializeGlyphVector(int count, WKGlyphVectorRef glyphs);
135 void WKClearGlyphVector(WKGlyphVectorRef glyphs);
136
137 int WKGetGlyphVectorNumGlyphs(WKGlyphVectorRef glyphVector);
138 ATSLayoutRecord *WKGetGlyphVectorFirstRecord(WKGlyphVectorRef glyphVector);
139 size_t WKGetGlyphVectorRecordSize(WKGlyphVectorRef glyphVector);
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 void WKDrawMediaFullscreenButton(CGContextRef context, CGRect rect, BOOL active);
168 void WKDrawMediaMuteButton(CGContextRef context, CGRect rect, BOOL active);
169 void WKDrawMediaPauseButton(CGContextRef context, CGRect rect, BOOL active);
170 void WKDrawMediaPlayButton(CGContextRef context, CGRect rect, BOOL active);
171 void WKDrawMediaSeekBackButton(CGContextRef context, CGRect rect, BOOL active);
172 void WKDrawMediaSeekForwardButton(CGContextRef context, CGRect rect, BOOL active);
173 void WKDrawMediaSliderTrack(CGContextRef context, CGRect rect, float percentLoaded);
174 void WKDrawMediaSliderThumb(CGContextRef context, CGRect rect, BOOL active);
175 void WKDrawMediaUnMuteButton(CGContextRef context, CGRect rect, BOOL active);
176
177 #ifdef __cplusplus
178 }
179 #endif