Mac Developer Library

Developer

Carbon Framework Reference WebKit C Reference

Options
Deployment Target:

On This Page

WebKit C Reference

The WebKit C API provides a way to embed a web view in a Carbon window. Once you have added the view to a window, you must load information to display URL content using Objective-C classes.

For more details on how to add web views to your application and how to display and manage content using Objective-C APIs, see Displaying Web Content.

Functions

  • Initializes the WebKit.

    Declaration

    Objective-C

    void WebInitForCarbon ( void );

    Discussion

    You must call this function before making any other WebKit calls. This function will call NSApplicationLoad, InstallEventLoopIdleTimer, and create a NSAutoreleasePool. This function only needs to be called once. Several calls to this function will do nothing, this is important in the case of plug-in bundles. Lastly, you do not need to call NSApplicationLoad and create a NSAutoreleasePool if you call this function.

    Import Statement

    Availability

    Available in OS X v10.2 with Safari 1.0 and later.

    Deprecated in OS X v10.6.

    Not available to 64-bit applications.

  • Creates an HIView-based container for web content.

    Declaration

    Objective-C

    OSStatus HIWebViewCreate ( HIViewRef *outControl );

    Parameters

    outControl

    On return, outControl points to the newly-created web view.

    Return Value

    A result code.

    Discussion

    The web view is a standard HIView, so you can use any of the standard HIView functions to manipulate it. Note however, that the web view cannot currently be obscured by other views above it.

    Import Statement

    Availability

    Available in OS X v10.2 with Safari 1.0 and later.

    Deprecated in OS X v10.6.

    Not available to 64-bit applications.

  • Obtains the Cocoa NSView associated with the web view.

    Declaration

    Objective-C

    WebView * HIWebViewGetWebView ( HIViewRef inView );

    Parameters

    inView

    The web view whose Cocoa equivalent you want to obtain.

    Return Value

    The Cocoa equivalent of the web view.

    Discussion

    You must obtain the Cocoa web view if you want to make native Cocoa calls to manipulate the view contents.

    Import Statement

    Availability

    Available in OS X v10.2 with Safari 1.0 and later.

    Deprecated in OS X v10.6.

    Not available to 64-bit applications.

  • Creates a Core Graphics image from a Cocoa NSImage.

    Declaration

    Objective-C

    CGImageRef WebConvertNSImageToCGImageRef ( NSImage *inImage );

    Parameters

    inImage

    A reference to the Cocoa NSImage to convert.

    Return Value

    A reference to the Core Graphics image.

    Discussion

    You may need to use this function if you want to display icons for URLs from the history or page icons.

    Import Statement

    Availability

    Available in OS X v10.2 with Safari 1.0 and later.

    Deprecated in OS X v10.6.

    Not available to 64-bit applications.