You are currently viewing a snapshot of www.mozilla.org taken on April 21, 2008. Most of this content is highly out of date (some pages haven't been updated since the project began in 1998) and exists for historical purposes only. If there are any pages on this archive site that you think should be added back to www.mozilla.org, please file a bug.



CHBrowserView

by Mike Pinkerton

Goals:

  • Provide a Cocoa NSView for embeddors - this is done with CHBrowserView.
  • Native widgets - a native Cocoa app is going to want native widgetry
  • Buildable from ProjectBuilder - we will provide a Cocoa framework for Gecko

Topics:

  • Building
  • Embedding


Building

To build the standalone mozilla with the Cocoa widget library:

1. Follow the instructions on the FizzillaMach build page for setup, pulling and building.

2. Create a file called .mozconfig in your mozilla directory. In it, put the following line

ac_add_options --enable-default-toolkit=cocoa

3. Configure, and build again. This will replace the Carbon widget implementation with Cocoa.

% ./configure
% make -f client.mk build

Once you've done that, things get more interesting. We next move to building the embedded test app for Cocoa.

1. Build embed.jar

  • % cd embedding/config
  • % make

2. Build the mozilla framework for embedding with ProjectBuilder. Note that this is a ProjectBuilder 2.0 project and may not work in ProjectBuilder 1.x on OSX 10.1.5

  • Double-click mozilla/embedding/browser/cocoa/src/NSBrowserView.pbproj
  • Click the build button

3. Enjoy!

Embedding

<More to come on how this actually works>

There are three parts to the Cocoa effort:

  1. Widget/GFX impemented in Cocoa
  2. An CHBrowserView that subclasses NSView and wraps all of Gecko
  3. The Cocoa-based embedding application

Currently, only the widget library has been ported to Cocoa, and not yet all of it. It works pretty well for embedded applications (like Camino). If you'd like to work on it, the code lives in mozilla/widget/src/cocoa.

The CHBrowserView lives in mozilla/embedding/browser/cocoa/src/. It's a good place to look at what it takes to wrap all of the embedding interfaces Gecko implements.

Our test harness for embedding the CHBrowserView lives in mozilla/embedding/tests/cocoaEmbed. It's a good place to learn about how to utilize an CHBrowserView in a real-world application.


What If It Doesn't Work?

There are two places to go for help building Fizzilla:

  • the #mozilla channel at irc.mozilla.org is a good place to find some mac weenies in real time who, if you ask nicely and don't be a pest, will happily get you on your way
  • post to the newsgroup netscape.public.mozilla.macosx


written by Mike Pinkerton (pinkerton@netscape.com)