Introduction To Mac OS 8.5
Volume Number: 14
Issue Number: 11
Column Tag: Programming Techniques
Programmer's Introduction to Mac OS 8.5
by Dan Parks Sydow
An overview of the Allegro features to incorporate into Mac
programs
Overview
A few years back, Apple's years-in-the-making Copland promised to be the operating
sytem to modernize the Macintosh. As we all now know, the Copland effort fell behind
and was scrapped. But many of Copland's technologies were preserved, and emerged in
the 1997 introduction of Mac OS 8. With millions of copies of Mac OS 8 sold in just
months, it's obvious that users were anxious to put a new user interface on their Macs.
Now, the first major upgrade to Mac OS 8 has arrived. While the changes and
enhancements from Mac OS 8 to Mac OS 8.5 (code-named Allegro) may not be quite as
dramatic as those from Mac OS 7.x to Mac OS 8, they are still very impressive. Like
Mac OS 8, Mac OS 8.5 will be considered a "must have" operating system upgrade by
many Mac users. With this in mind, you'll want to make sure that your own Macintosh
applications support the features expected of a program running under Mac OS 8.5.
Mac OS 8.5 includes a host of new user-friendly features and user interface
improvements, including improved Internet functionality, an enhanced Find command
(that includes file-content and Internet searching), HTML-based help system, and
much more. While all these improvements are a boon to the Mac user, not all are of
direct relevance to the Mac programmer. For instance, desktop-related Mac OS 8.5
enhancements (such as the improved Find command) don't affect a Mac programmer.
On the other hand, the integration of the Appearance Manager and Navigation Services
into the operating system do affect the Mac developer.
Mac OS 8.5 also includes a number of behind-the-scenes changes such as more
PowerPC-native code and a PowerPC-native AppleScript. While these changes may
help your application indirectly, you won't need to expend any effort to include them in
your program. For example, more PowerPC-native code may speed up your program's
execution without you rebuilding the program. Other non-interface changes are of
importance to programmers. Most notable are the new Toolbox routines that bump up
the version number to 2.0 for each of three managers: Window Manager, Dialog
Manager, and Menu Manager.
This article provides an overview of how to implement the new interface features of
Mac OS 8.5 (such as Appearance and Navigation Services) and a summary of some of
the most important new Toolbox functions accompanying Mac OS 8.5.
Appearance Manager
The sleek look provided by the Appearance Manager is often referred to as Appearance.
For the user, Appearance is provided by the Appearance control panel. This tabbed
control panel allows the user to choose a theme that defines the overall look of user
interface elements (Figure 1 shows the Appearance control panel with the Themes
tab selected). A theme is simply the combination of a number of Appearance control
panel options, including appearance, font, desktop pattern, and so forth. Of these
options, it's the appearance that's most thought of as the theme itself - the appearance
establishes the overall look of interface elements such as windows and menus. Mac OS
8.5 ships with a number of Apple-supplied themes, all based on the Apple platinum
appearance. Notable by their absence are the oft-mentioned Gizmo and Hi-Tech
appearances. Though these appearances may resurface in the future.
Figure 1. The Appearance control panel with the Themes tab selected.
Apple's user interface guidelines exist so that all Mac programmers develop
applications that have a certain commonality in their look and behavior. For users,
this similarity in look-and-feel between applications is comforting, and lessens the
time needed to learn how to use new applications. Giving the user the power to
radically alter the look of windows and their user interface elements seems to defy
Apple's user interface guidelines. If done on a systemwide level, though, it doesn't.
While the desktop GUI elements may look different on one Mac than they do on another,
to each individual user his or her machine displays things in a consistent manner. So
machine-to-machine differences aren't relevant (though one could argue that a novice
forced to work on different Macs might get confused).
For the programmer, the Appearance Manager consists of a number of new Toolbox
routines. While Mac OS 8.5 integrates the Appearance Manager into the operating
system, the benefits of this manager were available to developers prior to Mac OS 8.5.
By including Appearance Manager function calls in your own source code, linking your
compiled code to the Apple-supplied Appearance shared library, and distributing your
application with the Appearance Extension, you had the option of supplying pre-Mac
OS 8.5 users with Appearance features. Because the new look provided by the
Appearance Manager has been described in other sources, including the January 1998
issue of MacTech Magazine (Vol. 14, No. 1), it is covered only lightly here.
Checking for Appearance
Appearance is built into Mac OS 8.5 - there's no need for the Appearance Extension to
be present in the Mac OS 8.5 user's System Folder. But unless you know for certain
that your own Appearance-savvy application will be running on only Mac OS 8.5 or
later systems (a very unlikely scenario), your program needs to check the user's
machine for the presence of Appearance. To do this, pass the gestaltAppearanceAttr
selector to the Gestalt() function and test the response against
gestaltAppearanceExists.
If the Appearance Manager isn't present, your application is running on a Mac with a
pre-Allegro version of the Mac OS that doesn't have the Appearance Extension installed
(or has it present but disabled). You'll want to let the user know that Appearance is
necessary, and you'll want to supply further instructions (such as how to install the
Appearance control panel and extension if you supply them with your application). If
the Appearance Manager is present, call RegisterAppearance() to initialize this
manager.
Navigation Services
The Open and Save dialog boxes provided by Standard File can be a source of confusion
for users new to the Macintosh. This confusion stems from the differences in how file
browsing is accomplished on the desktop and in the Standard File dialog boxes. Other
drawbacks to these dialog boxes include the inability to select multiple files and the
lack of a means to quickly reselect recently chosen files. Navigation Services was
designed to overcome all these limitations and to add several other enhancements to the
Open and Save dialog boxes (the Open dialog box is shown in Figure 2).
Figure 2. The Open dialog box provided by Navigation Services.
For the programmer, Navigation Services, like the Appearance Manager, consists of a
number of new Toolbox routines. Again like the Appearance Manager, Navigation
Services have been integrated into Mac OS 8.5, but its features were available prior to
this latest version of the Mac operating system. By including Navigation Services
function calls in your project's source code and linking your compiled code to the
Apple-supplied Navigation shared library, you were able to supply pre-Mac OS 8.5
users with Navigation features. Because Navigation Services support the Appearance
Manager, in the past it was also required that a program making use of Navigation