Hi Justin, On Jun 10, 2005, at 3:15 PM, Justin Haygood wrote:
Even though I'm nowhere near there yet (got to get JSCore working first ;) ), here is an idea:
Have KWQ use cross-platform C/C++ implementations, keeping everything as high level as possible, and use C++ inheritence to inherit from platform specific implementations.
for instance, QRegion can be implemented sans Cocoa for the stuff that is already cross platform, but inherit from a KWQRegion which has different implementations for Cocoa, Win32, GTK+, Qt (hey, why not?), wxWidgets, etc...
I definitely agree something like this would be very helpful, but I'm curious as to why you'd want to inherit the platform-specific implementation from the base implementation, rather than vice-versa. For example, what would be great for us is that the common classes all have KWQ(something)Base classes with virtual methods, from which we derive toolkit-specific implementations. This is helpful because even for completely "toolkit neutral" classes, like KWQBrush, we sometimes need to have a way of converting that to or from, say, a wxBrush that we can use. So with this approach, we could just add our accessor functions to a toolkit-specific implementation, and reuse the rest from the common implementation. For classes with no real way of having a 'toolkit-independent' implementation, base classes could just be stubs. Doing things this way, we don't need to create a custom implementation if we don't need it - we just reuse the base class. But if we want to extend it in any way, we can just by deriving from it, and the only thing we ever need to worry about maintaining are our own extensions. :-) This will do a lot, IMHO, to keep implementations synchronized. This is actually how wxWidgets goes about maintaining all those different implementations. Thanks, Kevin
possible directory layout:
KWQ\ Platform\ Cocoa\ C++ / Objective C sources for Cocoa GTK+\ C++ / C sources for GTK+ wxWidgets\ C++ sources for wxWidgets Win32\ C++ / C sources for Win32 \C++ sources which are fairly cross platform (there's plenty)
And possibly do this for other places as well... to separate Cocoa calls from the rest. _______________________________________________ webkit-dev mailing list webkit-dev@opendarwin.org http://www.opendarwin.org/mailman/listinfo/webkit-dev