• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Really using WebKit in Carbon
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Really using WebKit in Carbon


  • Subject: Really using WebKit in Carbon
  • From: Matt Gough <email@hidden>
  • Date: Tue, 24 Jun 2003 01:38:25 +0100

Having just downloaded the WebKit SDK I thought I'd have a go at updating
some old code that uses the much lamented HTMLRenderingLib.

I have read through the documentation, set up a private bundle to allow me
to use it, loaded all the function pointers from it and gave it a whirl.
Alas, nothing happened. It didn't crash (which implied my bundle set-up and
loading was good), and the control manager didn't complain about the HIView
that was created - just nothing got drawn).


Here are some snippets:

From the private bundle:

#include <Carbon/Carbon.h>
#include <Cocoa/Cocoa.h>
#include <WebKit/CarbonUtils.h>
#include <WebKit/HIWebView.h>

Boolean CWKInitialize()
{
WebInitForCarbon();
return true;
}

OSStatus CWKHIWebViewCreate(HIViewRef* outControl)
{
return HIWebViewCreate(outControl);
}

void CWKLoadPage(HIViewRef hiView, CFURLRef url)
{
NSAutoreleasePool *localPool = [[NSAutoreleasePool alloc] init];

WebView* wv = HIWebViewGetWebView(hiView);

if (wv)
{

[[wv mainFrame] loadRequest:[NSURLRequest requestWithURL:
(NSURL*)url]];
}

[localPool release];
}

From my main application:


Rect r = {50, 50, 500, 500};
WindowRef w;
ThrowIfErr(CreateNewWindow(kDocumentWindowClass,
kWindowStandardHandlerAttribute | kWindowCompositingAttribute , &r, &w));

::ShowWindow(w);
static const bool cwkInited = CWKInitialize();
if (cwkInited)
{
HIViewRef hiv;
ThrowIfErr(CWKHIWebViewCreate(&hiv));
WControlFoster asControl(hiv);
ThrowIfErr(::EmbedControl(hiv, HIViewGetRoot(w)));
SetControlBounds(hiv, &r);
CWKLoadPage(hiv, fso_i.GetURL());
::Draw1Control(asControl);
}


Has anyone else tried getting WebKit working from within a Carbon app (I
know its only been out a few hours, but I guess those of us not at WWDC have
nothing better to do)

All I want to do is draw the page, no interaction is needed with it.

Matt Gough
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • WebKit On Mac OS X server?
      • From: Brian Gilman <email@hidden>
  • Prev by Date: [ANN] Defaults Manager WWDC Promotion
  • Next by Date: Re: Overlapping focus rings, clipping?
  • Previous by thread: [ANN] Defaults Manager WWDC Promotion
  • Next by thread: WebKit On Mac OS X server?
  • Index(es):
    • Date
    • Thread