Giving some Juce to cross-platform tools
Juce in the spotlight
Hands on Last month I looked at Qt, the popular C++ cross-platform framework which underpins the KDE desktop, and a whole lot more. This time, I'm continuing that same theme by taking a look at another cross-platform C++ library called Juce (OK, no jokes about Apple Juce!)
Chances are pretty good that you've never actually heard of Juce: I certainly hadn't until Reg Developer reader Iain McGuire pointed me in the right direction. I downloaded the demo and was immediately smitten. Nice one, Iain!
Perhaps the most remarkable thing about Juce is that it's the work of one talented developer – Julian Storer. According to Wikipedia (see entry for "Tracktion"), the Juce C++ class library arose out of the work that Julian put into the development of his popular digital audio production suite. More on Tracktion here, but you can download Juce from the official website.
The library supports development on Mac OS X, Windows and Linux. It's currently at version 1.4, and you can freely download the complete source code tree from the website (around 2.5 MBytes). Don't bother looking for platform-specific source code downloads because there aren't any; all three platforms are integrated within the same source tree – more on that later. If you're not ready to start delving around in Julian's source code, and would rather get a feel for what Juce can do, there are pre-built binaries (for Mac and Windows) of a very impressive demo program which shows some of the library's main capabilities.
If you download the Win32 version of the demo, you might be surprised to discover that the EXE file tips the scales at a sylphlike 751 KBytes. That's quite impressive for a stand-alone program developed with a cross-platform library and no DLL dependencies. However, inquisitive bugger that I am, a quick sniff with HexEdit instantly revealed that Mr Storer had used the UPX compressor to scrunch the demo executable. Even so, at around 1.7 Mbytes (the uncompressed size), I'm still impressed. Static builds with other cross-platform libraries are often very much larger.
The most negative thing I can say about the demo is that I didn't like the washed-out pastel colour scheme, although I don't like XP's "Fisher-Price" look either; I'm hard to please where user interface aesthetics are concerned (check out Figure 1 and notice the subtle shadowing under the disk drive). What you will find, if you've got Windows and a Mac, is that the program looks identical when running on both platforms. The reason for this – as discerning readers will suspect by scrutinising the screenshots – is that Juce doesn't use the native widgets provided by each platform (a widget, in the context of cross-platform development, is a user interface control). Instead, the implementation of each widget is built right into the Juce library.
As already stated, this has the advantage of giving you identical results on each platform, and the further advantage that you're not at the mercy of whatever versioning vagaries Microsoft might plonk into the next iteration of (e.g.) the Common Controls DLL. On the negative side, the punters might not like the Juce equivalent of the control's they're familiar with. Then again, because full source code is included, you're free to tinker with the look and feel as much as you want. Most of the Juce widgets adopt a somewhat OS X-like look and feel - most notably push buttons.
You'll see that even the window frame is rendered by the Juce library. If this is a bit too outré for your target audience, there's an option to render using the native windowing system.
Note: Well actually, there's a small problem here: if you run the Juce demo under OS X, bring up a drop-down menu and then click on and drag away the native window frame, the menu will remain onscreen and get "left behind" rather than collapsing as it should. This bug doesn't affect the Win32 port (The Juce website proclaims that the number of known bugs is always zero because as soon as Julian hears about a bug, he fixes it immediately. Go to it, Julian!).
Sponsored: Hyper-scale data management