Page last modified: 16 January 1998
Most recent release: 2.0b1, 02 September 1996.
Zig's Greyscale Stuff is a control definition (CDEF) and window definition (WDEF) that implement a three-dimensional look that matches the look documented in Apple Grayscale Appearance for System 7.5, July 1996 Revision. There's also sample code for using the CDEF and WDEF in your own code.
It just seemed wrong not to update my little CDEF to support Apple's new standard for greyscale buttons, so I blew a few spare hours and updated the 3D Buttons CDEF. The result is Zig's Greyscale Buttons 2.0.
While writing the CDEF, I thought it might be fun to write a WDEF for the Apple Grayscale Appearance. The WDEF and CDEF share most of their code, as well as their design. So I blew a few spare weekends. The result is Zig's Greyscale Windows 2.0 (there is no 1.0: I just want all of Zig's Greyscale Stuff to have the same umbrella version number).
Zig's Greyscale Buttons and Zig's Greyscale Windows are both available as 68k, PowerPC native, and safe/fat resources. The safe/fat resources weigh in at 50K each, so I doubt everyone will rush to use them; but for those who want 'em, they're available on the download page.
I receive one or two emails a month asking how to use a CDEF in an application or a dialog. For those programmers who lack access to (or desire to read) Inside Macintosh, I now have a page describing everything you need to know to use a CDEF or WDEF in your own project.
Some time in 1995, Apple documented a look and feel that will look similar (but not identical to) the default theme in Mac OS 8. It defines yet another three-dimensional, greyscale look on the Mac OS. Read Apple Grayscale Appearance for System 7.5, July 1996 Revision for a description of the buttons and windows implemented by Zig's Greyscale Stuff, as well as other visual elements such as group boxes, separators, and window headers.
Zig's Greyscale Buttons and Zig's Greyscale Windows both limit their drawing on shallow devices. On 4-bit color or 2-bit (color or greyscale), Zig's Greyscale Buttons and Zig's Greyscale Windows switch to black and white drawing. The buttons and windows still use available greys to draw inactive titles. On 1-bit devices, Zig's Greyscale Buttons and Zig's Greyscale Windows try to avoid all Color QuickDraw calls. Zig's Greyscale Buttons should work just fine on Color QuickDraw-challenged Macs such as SEs and PowerBook 100s. Zig's Greyscale Windows might work on those devices, but is not guaranteed to do so. (I gotta draw the line somewhere: it's not like the WDEF is paying my mortgage!)
Try to avoid setting either custom CDEF or WDEF resource IDs to zero, because doing so overrides system definitions. For example, setting the CDEF or WDEF to ID 0 causes them to appear in Standard File dialogs. But Standard File dialogs are not designed with the Apple Grayscale Appearance in mind: the "New Folder" button still appears flat, there is no bezel around the scrolling list or edit text field, and the background is white instead of light grey.
I usually set the CDEF and WDEF resource IDs to 1000. This makes the procID math easy. See How to Call a Custom CDEF or WDEF for help with non-zero resource IDs.
Zig's Greyscale Buttons is a control definition (CDEF) that implements the greyscale interface as specified in Apple Grayscale Appearance for System 7.5, July 1996 Revision.
Just drop the CDEF into any application you write, under whatever ID you like. Read about the Control Manager in Inside Macintosh if you need help specifying a CDEF in your controls. Or read How to Call a Custom CDEF or WDEF by Carolyn Zichterman.
I defined icon buttons as variant 3. (push buttons = 0, check boxes = 1, radio buttons = 2, and now, by decree-o-Zig, icon buttons = 3). Your control rect should be at least:
These are minimums: your icon buttons will look better if you leave some whitespace. Non-square buttons will use a large, small, or tiny icon, depending on what fits. Set the value of the control to the icon ID. Icon buttons do not draw titles.
Important note to users of 3D Buttons 1.0b5 and earlier
The variant for icon buttons has changed. It is now 3 instead of 4. I needed 4 as a flag (see Indenting Buttons below).
Zig's Greyscale Buttons also implements tristate checkboxes and radio buttons. Set the control value to 2 to tristate it.
If you set bit 2 (mask 0x04) in the control's variant, push buttons and icon buttons will appear to indent the title or icon when highlighted, so that it looks like you've actually pushed in the button. The title or icon draws down and to the right by one pixel.
Add this mask (0x04) to variants the same way you add useWFont (0x08). For example, if you wanted a push button that uses the window font, you would use pushButProc(0) + useWFont(8) = 8. If you want a push button that indents the title when you push it, use pushButProc(0) + useWFont(8) + indentHighlighted(4) = 12.
Although this is not part of the interface described in Apple Greyscale Appearance for System 7.5, July 1996 Revision, this is a very common request and one that I felt was worth adding as an option.
If you're going to use the indenting flag, remember to make your buttons a little taller and wider to accommodate the indent. Chicago 12 titles require a pushbutton at least 21 pixels tall: anything shorter will clip descenders when indented (the bottom of lowercase "g"s will get chopped off). Icon buttons need to be one pixel taller and wider than specified in Icon Buttons above.
Unlike my earlier 3D Buttons CDEF, Zig's Greyscale Buttons does not honor custom control colors. These are greyscale buttons, after all. If you absolutely must have a hot pink OK button, you'll have to modify the source yourself.
Zig's Greyscale Windows is a window definition (WDEF) that implements the greyscale interface as specified in Apple Grayscale Appearance for System 7.5, July 1996 Revision.
Just drop the WDEF into any application you write, under whatever ID you like. Read about the Window Manager in Inside Macintosh if you need help specifying a WDEF in your windows. Or read How to Call a Custom CDEF or WDEF by Carolyn Zichterman.
Zig's Greyscale Windows support all the variants for having a zoom box and/or size box. You can drag the window by its edges (not just the title bar). When resizing, the window uses a thicker (2 pixel) outline, which is a bit easier to see. Window definitions (WDEFs) don't control the outline when moving a window, so that's still a nigh-invisible 1-pixel border.
Documents should still use a white background.
You can use this variant for modeless dialogs. If you do, you'll need a light grey background, and you will need to supply the modeless dialog bezels around the inside of your content region. You might want look at the bezel-drawing code in Zig's Greyscale Windows as sample code or a starting point.
A movable modal dialog is a window that lets the user move it around, and often lets the user switch out to other applications.
Zig's Greyscale Windows draws the window title and the bezels around the outside of the content region. Your content region should be light grey (0xDDDD).
In order to let Zig's Greyscale Windows draw the bezels, Zig's Greyscale Windows defines the bezels as part of the window's structure. This is similar to how the current System 7.5 movable modal dialog defines the border around the content as part of the structure region. Clicks in this portion of the window structure just beep; they do not drag the window around.
A modal dialog is a window that puts a message in the user's face and refuses to do anything until the user swats it away with a mouseclick or keystroke. Sometimes referred to as "idiot boxes".
In order to let Zig's Greyscale Windows draw the bezels, Zig's Greyscale Windows defines the bezels as part of the window's structure. This is similar to how the current System 7.5 modal dialog defines the border around the content as part of the structure region. Clicks in this portion of the window structure just beep.
Zig's Greyscale Windows support System 7.5.x's WindowShade control panel. Document and movable modal dialogs can be shrunk to be pretty much just a title bar. If you're interested in how to detect when a window is windowshaded, check the Macintosh Q&A in develop, issue 23.
Be careful when calculating the size of title bars! Apple Grayscale Appearance for System 7.5, July 1996 Revision specifies a title bar that is a few pixels taller than the default System 7.5.x window definition. Don't ignore the window frame around the window.
I ran out of steam before I started a second window definition (WDEF) for floating/utility/palette windows. You can write your own starting from my public domain WDEF source if you like. If you write it, I'd appreciate a copy.
Zig's Greyscale Windows ignores any colors set in a wctb, dctb, or actb resource. It also ignores the tinge color set in the Color control panel.
This is a shortcoming I'd like to see fixed someday. I like the red tinge in error alerts that prerelease Mac OS 8 had. (Will the tinge remain in the final version of Mac OS 8? I have no idea.)
Apple will soon release the Appearance Manager, probably by the end of 1997, possibly much sooner. The Appearance Manager is part of Mac OS 8 (previously known as Copland), and might be part of a Mac OS 7.5.x release before that.
Zig's Greyscale Stuff is smart enough to call through to the System control or window definition if using Mac OS 8 (or greater) or Zig's Greyscale Disabler.
Apple warns us developers that custom controls and windows prevent your application from automatically taking advantage of the Appearance Manager. Zig's Greyscale Stuff contains code that should work around this problem. If Zig's Greyscale Stuff detects the presence of Zig's Greyscale Disabler, it passes all calls through to the System control or window definition, which will probably still exist as a reverse-compatibility API in the Appearance Manager.
Use Zig's Greyscale Disabler if the Appearance Manager is released before Mac OS 8. Zig's Greyscale Disabler is not necessary for Mac OS 8 or greater. Copy Zig's Greyscale Disabler into the Extensions folder and reboot. Zig's Greyscale Disabler uses less than 100 bytes of system memory and consumes CPU time only when called by Zig's Greyscale Stuff. All it does is implement a private Gestalt selector that Zig's Greyscale Buttons and Zig's Greyscale Windows look for.
Zig's Greyscale Stuff (source and object) is in the public domain. Use it in your apps. Don't pay a cent. Strip away any mention of Zig. There's nothing I can (or will) do. It's public domain code. However, I would love to receive a copy of any software in which you use Zig's Greyscale Stuff.
I love to hear when someone actually uses Zig's Greyscale Buttons in a project. It makes all this work worthwhile.
Last modified: 16 January 1998.
Write to Zig Zichterman at ziggr@best.com.
Send comments about this documentation to Carolyn Zichterman at
czichtermn@aol.com.