How can I define a non rectangular desktop window shapes


#1

I’d like to create top level desktop windows that can have non-rectangular shapes. Ideally I could use either a “Path” or “RectangleList” object to specify this shape and then somehow apply it to the shape of the window itself.

For example, at a very basic level it would be nice to define a custom rounded rectangle for a DocumentWindow or ResizeableWindow. But I’d also like to create more exotic shapes that we see, for instance, in various media player skins and widgets etc. RectangleList would allow me to create a window shape from a bitmap for instance.

Is there a way to effectively do this with JUCE today? And in a cross platform way so it works on PC and Mac? If not, could we get one? :slight_smile:

I know on Win32 there is ::SetWindowRgn(HWND hWnd, HRGN hRgn, BOOL redraw) - but I’m not familiar with the Mac way of doing this.

Thanks,
Kurt.


#2

So I found a solution to my question posted by daskizzle - it appears to have what I need but I will experiment a bit to see if it can be applied to a DocumentWindow or ResizeableWindow.

The link is here:
http://www.rawmaterialsoftware.com/juceforum/viewtopic.php?t=954

Thanks,
Kurt.


#3

It is my understanding that the DocumentWindow and ResizeableWindow classes are fully skinnable, but the means by which this is accomplished is by deriving a Look and Feel class and customizing it. I have a basic example of this at: http://www.esnips.com/web/jucestuff.

There’s another way to acheive similar results by using a Juce Component derived class (as in Juce Shaped Window Demo) and then customizing that by adding a resizer and whatever else components to make it look and function like a typical window. Basically, it would be like making your own DocumentWindow class from all the Juce Components.

Also, it is my understanding that this is fully cross-platform (Windows, Mac OSX and Linux) with no code changes necessary across platforms unless you want platform specific features. Personally, I am amazed by this. For two years, I searched Google with “cross platform skinnable apps” and similar searches and continually ended up at the tutorial on designing skinnable Java UIs. That method seemed so clunky to me. But Juce has been a dream to work with and Jules not only updates like rabbits multiply, he catches and fixes bugs like nobody’s business.


#4

If it is non-rectangular then the button’s would probably not be where you want them and so on. Would be easiest and fastest to just full subclass it and draw/place everything manually…


#5