Home | History | Annotate | Download | only in mac
      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 NSMutableArray;
     52 @class NSMutableURLRequest;
     53 @class NSString;
     54 @class NSTextFieldCell;
     55 @class NSURLConnection;
     56 @class NSURLRequest;
     57 @class NSURLResponse;
     58 @class NSView;
     59 @class QTMovie;
     60 @class QTMovieView;
     61 #else
     62 typedef struct NSArray NSArray;
     63 typedef struct NSButtonCell NSButtonCell;
     64 typedef struct NSData NSData;
     65 typedef struct NSDate NSDate;
     66 typedef struct NSEvent NSEvent;
     67 typedef struct NSFont NSFont;
     68 typedef struct NSImage NSImage;
     69 typedef struct NSMenu NSMenu;
     70 typedef struct NSMutableArray NSMutableArray;
     71 typedef struct NSMutableURLRequest NSMutableURLRequest;
     72 typedef struct NSURLRequest NSURLRequest;
     73 typedef struct NSString NSString;
     74 typedef struct NSTextFieldCell NSTextFieldCell;
     75 typedef struct NSURLConnection NSURLConnection;
     76 typedef struct NSURLResponse NSURLResponse;
     77 typedef struct NSView NSView;
     78 typedef struct objc_object *id;
     79 typedef struct QTMovie QTMovie;
     80 typedef struct QTMovieView QTMovieView;
     81 #endif
     82 
     83 #ifdef __cplusplus
     84 extern "C" {
     85 #endif
     86 
     87 // In alphabetical order.
     88 
     89 extern void (*wkAdvanceDefaultButtonPulseAnimation)(NSButtonCell *);
     90 extern BOOL (*wkCGContextGetShouldSmoothFonts)(CGContextRef);
     91 extern CFReadStreamRef (*wkCreateCustomCFReadStream)(void *(*formCreate)(CFReadStreamRef, void *),
     92     void (*formFinalize)(CFReadStreamRef, void *),
     93     Boolean (*formOpen)(CFReadStreamRef, CFStreamError *, Boolean *, void *),
     94     CFIndex (*formRead)(CFReadStreamRef, UInt8 *, CFIndex, CFStreamError *, Boolean *, void *),
     95     Boolean (*formCanRead)(CFReadStreamRef, void *),
     96     void (*formClose)(CFReadStreamRef, void *),
     97     void (*formSchedule)(CFReadStreamRef, CFRunLoopRef, CFStringRef, void *),
     98     void (*formUnschedule)(CFReadStreamRef, CFRunLoopRef, CFStringRef, void *),
     99     void *context);
    100 extern id (*wkCreateNSURLConnectionDelegateProxy)(void);
    101 extern void (*wkDrawBezeledTextFieldCell)(NSRect, BOOL enabled);
    102 extern void (*wkDrawTextFieldCellFocusRing)(NSTextFieldCell*, NSRect);
    103 extern void (*wkDrawCapsLockIndicator)(CGContextRef, CGRect);
    104 extern void (*wkDrawBezeledTextArea)(NSRect, BOOL enabled);
    105 extern void (*wkDrawFocusRing)(CGContextRef, CGColorRef, int radius);
    106 extern NSFont* (*wkGetFontInLanguageForRange)(NSFont*, NSString*, NSRange);
    107 extern NSFont* (*wkGetFontInLanguageForCharacter)(NSFont*, UniChar);
    108 extern BOOL (*wkGetGlyphTransformedAdvances)(CGFontRef, NSFont*, CGAffineTransform*, ATSGlyphRef*, CGSize* advance);
    109 extern void (*wkDrawMediaSliderTrack)(int themeStyle, CGContextRef context, CGRect rect, float timeLoaded, float currentTime,
    110     float duration, unsigned state);
    111 extern void (*wkDrawMediaUIPart)(int part, int themeStyle, CGContextRef context, CGRect rect, unsigned state);
    112 extern NSString* (*wkGetPreferredExtensionForMIMEType)(NSString*);
    113 extern NSArray* (*wkGetExtensionsForMIMEType)(NSString*);
    114 extern NSString* (*wkGetMIMETypeForExtension)(NSString*);
    115 extern ATSUFontID (*wkGetNSFontATSUFontId)(NSFont*);
    116 extern double (*wkGetNSURLResponseCalculatedExpiration)(NSURLResponse *response);
    117 extern NSDate *(*wkGetNSURLResponseLastModifiedDate)(NSURLResponse *response);
    118 extern BOOL (*wkGetNSURLResponseMustRevalidate)(NSURLResponse *response);
    119 extern void (*wkGetWheelEventDeltas)(NSEvent*, float* deltaX, float* deltaY, BOOL* continuous);
    120 extern BOOL (*wkHitTestMediaUIPart)(int part, int themeStyle, CGRect bounds, CGPoint point);
    121 extern void (*wkMeasureMediaUIPart)(int part, int themeStyle, CGRect *bounds, CGSize *naturalSize);
    122 extern BOOL (*wkMediaControllerThemeAvailable)(int themeStyle);
    123 extern void (*wkPopupMenu)(NSMenu*, NSPoint location, float width, NSView*, int selectedItem, NSFont*);
    124 extern unsigned (*wkQTIncludeOnlyModernMediaFileTypes)(void);
    125 extern int (*wkQTMovieDataRate)(QTMovie*);
    126 extern float (*wkQTMovieMaxTimeLoaded)(QTMovie*);
    127 extern NSString *(*wkQTMovieMaxTimeLoadedChangeNotification)(void);
    128 extern float (*wkQTMovieMaxTimeSeekable)(QTMovie*);
    129 extern int (*wkQTMovieGetType)(QTMovie* movie);
    130 extern BOOL (*wkQTMovieHasClosedCaptions)(QTMovie* movie);
    131 extern void (*wkQTMovieSetShowClosedCaptions)(QTMovie* movie, BOOL showClosedCaptions);
    132 extern void (*wkQTMovieViewSetDrawSynchronously)(QTMovieView*, BOOL);
    133 extern void (*wkSetCGFontRenderingMode)(CGContextRef, NSFont*);
    134 extern void (*wkSetDragImage)(NSImage*, NSPoint offset);
    135 extern void (*wkSetNSURLConnectionDefersCallbacks)(NSURLConnection *, BOOL);
    136 extern void (*wkSetNSURLRequestShouldContentSniff)(NSMutableURLRequest *, BOOL);
    137 extern void (*wkSetPatternBaseCTM)(CGContextRef, CGAffineTransform);
    138 extern void (*wkSetPatternPhaseInUserSpace)(CGContextRef, CGPoint);
    139 extern CGAffineTransform (*wkGetUserToBaseCTM)(CGContextRef);
    140 extern void (*wkSetUpFontCache)();
    141 extern void (*wkSignalCFReadStreamEnd)(CFReadStreamRef stream);
    142 extern void (*wkSignalCFReadStreamError)(CFReadStreamRef stream, CFStreamError *error);
    143 extern void (*wkSignalCFReadStreamHasBytes)(CFReadStreamRef stream);
    144 extern unsigned (*wkInitializeMaximumHTTPConnectionCountPerHost)(unsigned preferredConnectionCount);
    145 extern void (*wkSetCONNECTProxyForStream)(CFReadStreamRef, CFStringRef proxyHost, CFNumberRef proxyPort);
    146 extern void (*wkSetCONNECTProxyAuthorizationForStream)(CFReadStreamRef, CFStringRef proxyAuthorizationString);
    147 extern CFHTTPMessageRef (*wkCopyCONNECTProxyResponse)(CFReadStreamRef, CFURLRef responseURL);
    148 extern BOOL (*wkIsLatchingWheelEvent)(NSEvent *);
    149 
    150 #ifndef BUILDING_ON_TIGER
    151 extern void (*wkGetGlyphsForCharacters)(CGFontRef, const UniChar[], CGGlyph[], size_t);
    152 #else
    153 #define GLYPH_VECTOR_SIZE (50 * 32)
    154 
    155 extern void (*wkClearGlyphVector)(void* glyphs);
    156 extern OSStatus (*wkConvertCharToGlyphs)(void* styleGroup, const UniChar*, unsigned numCharacters, void* glyphs);
    157 extern CFStringRef (*wkCopyFullFontName)(CGFontRef font);
    158 extern OSStatus (*wkGetATSStyleGroup)(ATSUStyle, void** styleGroup);
    159 extern CGFontRef (*wkGetCGFontFromNSFont)(NSFont*);
    160 extern void (*wkGetFontMetrics)(CGFontRef, int* ascent, int* descent, int* lineGap, unsigned* unitsPerEm);
    161 extern ATSLayoutRecord* (*wkGetGlyphVectorFirstRecord)(void* glyphVector);
    162 extern void* wkGetGlyphsForCharacters;
    163 extern int (*wkGetGlyphVectorNumGlyphs)(void* glyphVector);
    164 extern size_t (*wkGetGlyphVectorRecordSize)(void* glyphVector);
    165 extern OSStatus (*wkInitializeGlyphVector)(int count, void* glyphs);
    166 extern void (*wkReleaseStyleGroup)(void* group);
    167 extern BOOL (*wkSupportsMultipartXMixedReplace)(NSMutableURLRequest *);
    168 #endif
    169 
    170 extern BOOL (*wkUseSharedMediaUI)();
    171 
    172 #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
    173 extern NSMutableArray *(*wkNoteOpenPanelFiles)(NSArray *);
    174 #else
    175 extern void* wkNoteOpenPanelFiles;
    176 #endif
    177 
    178 #ifdef __cplusplus
    179 }
    180 #endif
    181 
    182 #endif
    183