This article is more than 1 year old

Discover OS X's hidden artistic side

Jobs' past revisited

For example, NSWinSliderKnobAbove will give you a circa Windows-95 horizontal slider knob, with the indicator pointing upwards. NSWinSliderKnobAbovePressed will give you the pressed-in variant of the same image. Among the others, there's NSWinRadio that's a radio button in its unselected state. It's a mystery why this set of bitmaps were added to AppKit and why they're still there.

Heads-up

Now, you might think the built-in icon list only contains only images from the distant past, but not so. With Leopard, Apple recently introduced official support for Heads Up Display (HUD) windows. The new Interface Builder makes it dead easy to crate a HUD window for your own app, but I guess we'll have to wait until Snow Leopard before Apple give us some nice HUD controls.

As you might expect, the glyphs used to build HUD windows are contained within the built-in icon list. Thus, NSHUDActiveTitleBarFill will give you a vertical strip that's used to provide the graduated fill for an active HUD window's title bar.

All the image names are provided in a file called NSImage Names, which I've included along with this month's demo project. You'll find that some of them are old, and some are very new. For example, Apple introduced a new AppKit class called NSDockTile along with Leopard. Amongst other things, this class allows you to customize the appearance of your application's icon as it sits in the Dock.

If you look at the images entitled NSBadge1&2, NSBadge3, NSBadge4, and NSBadge5, you should gain some understanding of how NSDockTile works internally: rather than rendering that jagged-edged red lozenge from scratch, it selects the appropriate glyph depending on how many characters you've asked to display on the icon badge. Clever, eh?

Scrollbar image

ThemeWidget delivers a scrollbar glyph

Finally, as promised, this month's demo project demonstrates another mechanism whereby AppKit obtains the necessary glyphs used to support the Aqua interface.

My little ThemeWidget application makes use of an undocumented routine, _NSGetThemeWidgetImage, which is very heavily used "under the hood". It takes an image identity and retrieves the requested glyph.

Now, I haven't totally figured this out yet and you'll see from my code the list of valid image ID's is non-contiguous, hence the need to scan forwards or backwards until a new image is found. With that proviso in mind, you can download the demo application and source code here

More about

TIP US OFF

Send us news


Other stories you might like