Matt Legend Gemmell Modesty is Lying

Mac OS X Cocoa and iPhone Development Services available at Instinctive Code.
Favorites icon
Favorites for iPhone
Speed-dial with style.
Mac OS X Cocoa and iPhone Developer for hire

Other Pages

Categories

Posted
19 February 2006 @ 1pm

Categories
Development, Interface, Source

Tags
, , , , , ,

Updated iTunes 5 window code (yet again)

I’ve updated the Polished Metal (iTunes) window style code again; grab it from my Cocoa Source Code page. Read on for changes.

New stuff:

  • 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.

Do enjoy.


2 Comments

Alan
8 August 2006 @ 4pm

Thanks mf.


Brian Amerige
30 August 2006 @ 11pm

Hey there,

I’m using Polished Window (great stuff!) in an upcoming app of mine, but I’ve got a bit of an issue. I’m not too sure if this is related to PolishedWindow or not, but it’s always worth a shot, yes?

I’ve got a menu item which calls a method to open a sheet. Here’s the code:

- (IBAction)openConnectionSheet:(id)sender
{
[NSApp beginSheet: newConnectionSheet
modalForWindow: window
modalDelegate: self
didEndSelector: @selector(closeConnectionSheet:)
contextInfo: nil];
}

Problem is, when I execute the menu item, it returns:

-[NSMenuItem _setModal:]: selector not recognized [self = 0x3674e0]

Is this related to PolishedWindow being in my project, because it affects my window-configuration?


Leave a Comment

Updated iTunes 5 window code (again) Dual Input in Cocoa