Hi all,

I've been working on embedding the Mozilla control into the wxWindows toolkit. Since my home and work computers are Macs, I decided to develop and test on OS X (10.2.2). I've been able to build Fizzilla Mach, and the embedding base library (libembed_s.a) fine. (I ran make in both the /embedding/base and /embedding/config directories.) I have also successfully linked them into a wxWindows application and copied all the files in /dist/Embed/ into the root of the wxWindows app. The wxWindows app runs without crashing. However, I cannot see the Mozilla window in the application. I can see the Mac Window itself, just no Mozilla inside of it. Mozilla is sending a number of messages to the command line, so I know that embedding has started and is functional. I've also checked the PowerPlant example, and could not find any significant differences there. (Though it's very possible I'm missing something!)

The two main classes for the wxMozilla control are "wxMozillaBrowser" and "wxMozillaBrowserChrome". wxMozillaBrowser implements the wxWindows interface for the control, while Chrome implements all the embedding interfaces (in this case, the nsIWebBrowserChrome, nsIWebBrowserChromeFocus, nsIWebProgressListener, nsIEmbeddingSiteWindow, and nsIInterfaceRequestor interfaces).

Chrome of course is where most of the embedding magic happens. Here's a basic outline of how the app works:

1. Create the wxApp and start it's main loop

2. Create the wxBrowserWindow, and call its constructor.

3. Inside the constructor, create the wxWindow control, start embedding (NS_InitEmbedding), create the Chrome, and call its CreateBrowser method.

4. Inside CreateBrowser, I create the nsIWebBrowser and nsIBaseWindow interfaces, then I create a new widget (nsIWidget) and pass it the WindowRef of the top level window. Then, I call the mBaseWindow->InitWindow function and pass in the new widget as the first parameter. (As in the PowerPlant example.) Lastly, I call mBaseWindow->Create, then newWidget->Show and mBaseWindow->SetVisibility. I also implement the nsIWebNavigation interface (mWebNav) and call a mWebNav->LoadURI function to test the browser.

Is there any step(or steps) I'm missing here? In my Google searches, I've seen some comments regarding setting up an event loop for Mozilla when embedding, is this necessary to make it visible and if so, is there an example of how to implement this?

Many thanks for any help you can give! I'd really like to get this working, as embedding Mozilla (especially the editor, which is my ultimate goal here) will provide some much needed functionality for an application I am working on. And there is definitely an interest in making Mozilla accessible to the wxWindows toolkit. =)

BTW, if anyone is interested in looking directly at the code, the code is available at: http://www.theolliviers.com/wxmozilla.zip

Thanks,

Kevin

Reply via email to