I’ve updated the Polished Metal (iTunes) window style code again; grab it from my Cocoa Source Code page. Read on for changes.
- Can now also draw a "flat" version of the Polished Metal window, as seen in GarageBand's floating keyboard window.
- Fixed problem with flickering at low widths (see below).
- We now only add the textured window mask if it's not already there (harmless, but useful as an example).
- We now set a central window background color to match the Polished texture.
- We now disable the NSToolbar baseline separator of any attached toolbars by default (on OS X 10.4 or later). This was mostly at the request of the Metal Adium guys, and you can easily re-enable the baseline if desired by commenting out the setToolbar: override and rebuilding your project.
About the flickering at low widths thing, it was happening with the top middle and bottom middle images, which are colors made of pattern-images. At window widths of less than 255 pixels (a highly suspicious number indeed), the pattern would flicker and get messed up seemingly at every alternate width below 255.0. I’m pretty sure I had the setPatternPhase: values correct, and I’m at a loss to explain why it was happening. I’ve left the old version online in case anyone wants to take a peek; I’d certainly love to hear an explanation.
For now though, I composite the pattern-image color into an NSImage of at least 300 pixels in width (or the width of the window, whichever is greater), and copy a chunk of that image into the top-middle or bottom-middle of the window’s background ‘color’ (pattern image), as appropriate. Seems to work fine.