The Iconfactory


Home Support Item

Any tips on 32-bit Mac icons (in Resources)?

This support item will help developers who are creating Carbon applications using traditional resource files (as opposed to NIB files.)

We’re going to assume that you’re using Resourcerer to manage the 32-bit icon resources. And since a picture’s worth a thousand words, we’re going to be referring to the resources in this file. The resources in this sample file should help you figure out how to update your own UI resources.

You’ll want to avoid ‘cicn’ resources since they only allow 256 color icons. Instead, we use 32-bit icons, which are referred to as “icon suites” in the Appearance Manager (and in the Resourcerer application.)

An icon suite is a collection of resources that are used to render the icon on the UI control. The resource names for the suite are: ICN#, ics#, icl4, ics4, icl8, ics8, il32, is32, l8mk, s8mk (the last 4 are the 32-bit icons and the 8 bit masks, small and large versions.)

When you define your control resource, you can specify the icon suite ID in the CNTL definition. The control will then use the icon to display the control.

In the Sample resource file, there’s a DLOG with a three items:

  • A button control (item 1) which use CNTL 128.
  • A plain icon graphic (item 2) which uses CNTL 129.
  • An icon well (item 5) which uses CNTL 130.

All of these CNTL definitions use icon suite 128.

The resources in the icon suite are created using IconBuilder. Resourcerer can not edit or display the resources, so IconBuilder will become your icon suite editor.

By default, IconBuilder saves all of the resources in a single ‘icns’ resource. Unfortunately, the Appearance Manager does not recognize this resource; you have to store them individual resources (e.g. ‘ICN#’, ‘l8mk’, etc.) In IconBuilder’s Save Options dialog, you’ll want to make sure that “Add resources for Appearance Manager” is turned on.

Now, for those of you who are writing your own code to display icon resources you’ll need to familiarize yourself with Icon Services. Since PlotIconID does not recognize 32-bit icons, you’ll need to use new API entry points like PlotIconRef to display the icons. We wrote an article for MacTech last century—fortunately it is still relevant, even if the code is a bit dusty. If you’re interested, download a copy of the article.

Search for similar items

Can't Find It?

We've tried to anticipate most questions you might have. However, if you can't find the answer you're looking for here, send us your query and we'll answer it personally.

Send to: