Reviewed by Alexey.
[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 #ifdef __cplusplus
12 extern "C" {
13 #endif
14
15 typedef enum {
16     WKCertificateParseResultSucceeded  = 0,
17     WKCertificateParseResultFailed     = 1,
18     WKCertificateParseResultPKCS7      = 2,
19 } WKCertificateParseResult;
20
21 NSString *WKCreateURLPasteboardFlavorTypeName(void);
22 NSString *WKCreateURLNPasteboardFlavorTypeName(void);
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 OSStatus WKSyncWindowWithCGAfterMove(WindowRef);
47 unsigned WKCarbonWindowMask(void);
48 void *WKGetNativeWindowFromWindowRef(WindowRef);
49 OSType WKCarbonWindowPropertyCreator(void);
50 OSType WKCarbonWindowPropertyTag(void);
51
52 typedef id WKNSURLConnectionDelegateProxyPtr;
53
54 WKNSURLConnectionDelegateProxyPtr WKCreateNSURLConnectionDelegateProxy(void);
55
56 void WKDisableCGDeferredUpdates(void);
57
58 Class WKNSURLProtocolClassForReqest(NSURLRequest *request);
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 WKDrawFocusRing(CGContextRef context, CGRect clipRect, CGColorRef color, int radius);
94     // Ignore the context's clipping.
95     // The CG context's current path is the focus ring's path.
96     // A color of 0 means "use system focus ring color".
97     // A radius of 0 means "use default focus ring radius".
98
99 void WKSetDragImage(NSImage *image, NSPoint offset);
100
101 void WKDrawBezeledTextFieldCell(NSRect, BOOL enabled);
102 void WKDrawTextFieldCellFocusRing(NSTextFieldCell*, NSRect);
103 void WKDrawBezeledTextArea(NSRect, BOOL enabled);
104 void WKPopupMenu(NSMenu*, NSPoint location, float width, NSView*, int selectedItem, NSFont*);
105
106 void WKSendUserChangeNotifications(void);
107 BOOL WKConvertNSEventToCarbonEvent(EventRecord *carbonEvent, NSEvent *cocoaEvent);
108 void WKSendKeyEventToTSM(NSEvent *theEvent);
109 void WKCallDrawingNotification(CGrafPtr port, Rect *bounds);
110
111 BOOL WKGetGlyphTransformedAdvances(NSFont *font, CGAffineTransform *m, ATSGlyphRef *glyph, CGSize *advance);
112 CGFontRef WKGetCGFontFromNSFont(NSFont *font);
113 void WKGetFontMetrics(NSFont *font, int *ascent, int *descent, int *lineGap, unsigned *unitsPerEm);
114 NSFont *WKGetFontInLanguageForRange(NSFont *font, NSString *string, NSRange range);
115 NSFont *WKGetFontInLanguageForCharacter(NSFont *font, UniChar ch);
116 void WKSetCGFontRenderingMode(CGContextRef cgContext, NSFont *font);
117 ATSUFontID WKGetNSFontATSUFontId(NSFont *font);
118 void WKReleaseStyleGroup(void *group);
119 BOOL WKCGContextGetShouldSmoothFonts(CGContextRef cgContext);
120
121 void WKSetPatternPhaseInUserSpace(CGContextRef, CGPoint);
122
123 #define WKGlyphVectorSize (50 * 32)
124
125 typedef void *WKGlyphVectorRef;
126 OSStatus WKConvertCharToGlyphs(void *styleGroup, const UniChar *characters, unsigned numCharacters, WKGlyphVectorRef glyphs);
127 OSStatus WKGetATSStyleGroup(ATSUStyle fontStyle, void **styleGroup);
128 OSStatus WKInitializeGlyphVector(int count, WKGlyphVectorRef glyphs);
129 void WKClearGlyphVector(WKGlyphVectorRef glyphs);
130
131 int WKGetGlyphVectorNumGlyphs(WKGlyphVectorRef glyphVector);
132 ATSLayoutRecord *WKGetGlyphVectorFirstRecord(WKGlyphVectorRef glyphVector);
133 size_t WKGetGlyphVectorRecordSize(WKGlyphVectorRef glyphVector);
134 ATSGlyphRef WKGetDefaultGlyphForChar(NSFont *font, UniChar c);
135
136 NSEvent *WKCreateNSEventWithCarbonEvent(EventRef eventRef);
137 NSEvent *WKCreateNSEventWithCarbonMouseMoveEvent(EventRef inEvent, NSWindow *window);
138 NSEvent *WKCreateNSEventWithCarbonClickEvent(EventRef inEvent, WindowRef windowRef);
139
140 CGContextRef WKNSWindowOverrideCGContext(NSWindow *, CGContextRef);
141 void WKNSWindowRestoreCGContext(NSWindow *, CGContextRef);
142
143 BOOL WKSupportsMultipartXMixedReplace(NSMutableURLRequest *request);
144 NSString* WKPathFromFont(NSFont *font);
145
146 BOOL WKCGContextIsBitmapContext(CGContextRef context);
147
148 void WKGetWheelEventDeltas(NSEvent *, float *deltaX, float *deltaY, BOOL *continuous);
149
150 BOOL WKAppVersionCheckLessThan(NSString *, int, double);
151
152 #ifdef __cplusplus
153 }
154 #endif