HUDWindow

Another week, another custom window style no-one else bothered to make. This time, it’s a recreation of iPhoto’s “Adjust” palette, in the form of HUDWindow (an NSPanel subclass). Download the source code from my Cocoa Source Code page, and/or take a look at a screenshot.

9 comments

  1. I took a quick look at the source- I guess you wern’t aware of NSWindow’s setMovableByWindowBackground:(BOOL) :)

    You can strip out the mouseDown and mouseDragged stuff with that.

    -gus

  2. Are you planning to add the cool bevel/gradient/glass effect that this Window has in iPhoto? It’s a nice start, but it still looks rather flat. Also, I guess eventually there’d need to be all the custom controls to go with this window as well…

  3. Gus: Ah true. That was in there to limit dragging to the titlebar area, until I realised that iPhoto’s one allows you to drag it from anywhere. Good to know that the standard method works for borderless windows too.

  4. Uli, I’ve not seen iPhoto ’06 in detail yet, and the window is flat in ’05. I’ll take a look for screenshots online sometime.

  5. I’ve updated the source now to remove the superfluous manual dragging code, and to just call -setMovableByWindowBackground:YES. I also had an unnecessary instance variable in there, which is now also gone.

    Uli, regarding the “gradient/glass effect” you talk about, I got a friend to send me a screenshot of the Adjust palette in iPhoto ’06, and it looks just like the one in iPhoto ’05 (and thus like HUDWindow too). I guess you might mean something from Aperture instead. :)

  6. Lovely little style! I do have one question though… seems like the window only gets a close widget if you create it programmatically like you do in your controller class in the example. If you create an NSPanel in Interface Builder and set its custom class to HUDWindow, it works exactly as it ought to except there’s no close widget. I’m not sure what the difference is between what you’re doing and what IB is doing to instantiate the window, but is there anything that can be done about this? :)

  7. Source has been updated to address the issue Brian mentioned, by the way. Get it from the same link mentioned above.

  8. Now all we need is a whole suite of HUDControls. The Sliders, Buttons etc ;)

    Great work though. Many thanks.

  9. FYI: Just ran the Clang Static Analyzer on HUDWindow and it found a small leak: the NSMutableParagraphStyle allocated in line 176 of HUDWindow.m is never released.

Leave a comment