Title Banner

Previous Book Contents Book Index Next

Newton Developer Technical Information: Newton Programmer's Guide: 2.1 OS Addendum /
Chapter 6 - Drawing and Graphics 2.1 / Using Drawing and Graphics in the Newton 2.1 OS


Creating Gray Extras Drawer Icons

Gray icons are created as a pair of normal and a highlighted icons. Each of these icons is a pix family. Gray icons are stored in a part frame's iconPro slot. To remain compatible with previous system versions, the part must also contain an icon slot with black and white data.

Note that icons in the button bar are clipped if they are too large. Also, since the button bar is gray, you must include a mask with your icon, The mask should be lightly larger than the icon. The size of the mask must be no larger than 29x32, and the size of the regular icon must be less than 27x30. For more information on how to create icons, see Chapter 5, "Icons," in Newton 2.0 User Interface Guidelines.

Note
The size of all PICTs in a pix family must be identical. That is, they must be selected with the same size selection rectangle. An icon's mask should larger in the sense of having a larger image, that is the mask should heave more on bits than the icon has non-white pixels.
Icons for form parts (application parts) can be created with NTK's application icon editor. For information on this editor, see "Application Icon Editor". For other kind of parts (auto parts, store parts, etc.) you must create them programmatically with the *MakeExtrasIcons function, and add them to your part frame with the SetPartFrameSlot function. The code example in Listing 6-1 shows how to assign an icon to a part programmatically.

Listing 6-1 Code to add an icon and iconPro slot to a part frame

// example giving an icon to a non-form part - works for 2.0 and // later devices (NTK's Project Setting handles this for form parts)

OpenResFile(HOME & "foo.rsrc"); extrasIcons := MakeExtrasIcons([ {unhilitedRsrcSpec: "foo.bw", //b&w normal icon hilitedRsrcSpec: "foo.bw.hilited", //b&w hilited icon bitDepth: 1}, {unhilitedRsrcSpec: "foo.gray",//gray normal icon hilitedRsrcSpec: "foo.gray.hilited", //gray hilited icon bitDepth: 4}, ], "foo.mask", //mask for normal icons "foo.hilited.mask" //mask for hilited icons ); SetPartFrameSlot('iconPro, extrasIcons.iconPro); SetPartFrameSlot('icon, extrasIcons.icon); SetPartFrameSlot('text, "foo"); // must have a text slot or the part //is ignored by the Extras Drawer CloseResFile();


Previous Book Contents Book Index Next

© Apple Computer, Inc.
26 APR 1997



Navigation graphic, see text links

Main | Top of Section | What's New | Apple Computer, Inc. | Find It | Feedback | Help