JUCE Shaped Window Demo

For those curious minds who are eager, as I once was, to know how to create a shaped window using Juce, I offer this simple demo. The project file is for Dev C++, but should easily be accessible in another IDE. The Main.cpp file can be altered in Jucer and the project compiled, instantly showing changes. Currently, however, Juce writes a g.fillAll command in the graphics section which must be commented out or deleted, otherwise the window will show as a rectangle.

Please be informed that, as I am a newbie to Juce and C++, the project may not be the most perfect example as to how one should best accomplish such a thing. This example, unlike my first example, belongs in the “Juce\Projects\Juce Shaped Window Demo” folder.

Get it here:

(FYI: If you want to stop the jucer adding a g.fillAll command, you should just set the component’s background colour to transparent.)

Somebody shoot me! I didn’t even notice the ‘alpha’ value in Jucer. That means this example can also utilize multiple layers of transparency directly through alterations in the Jucer file. It’s all over now!

I’ve updated the file. Thanks again Jules.

I’ve seen this discussed but not a full working example…

Can someone post a quick example of how to apply resizing (drag and maximize) to a non-window component (like this example)?


Anyone have something like this lying around?

I’m really struggling with resizing a non DocumentWindow component.

If I resize this app to some bigger size, then the response to buttons becomes excessively slow, even if i redraw only the clip region. Is this normal, Jules?
I seems that an application not having a DocumentWindow gets terribly slow on GUI side. Is it still possible to make a “non-rectangular” app using DocumentWindow?
(doing a whiteTransparent document window gives an assertion)

It’s got nothing to do with it being a documentwindow - more likely you’re using a semi-transparent component, which is very slow on windows. See setOpaque().