Mac OS X Programming

( 1 )


This book provides the reader with definitions, details, and explanations of the various components that make up this new operating system. Understanding the operating system helps the reader use the programming tools and the Carbon application programming interface (API) - both of which are covered extensively in this book.

Mac OS X is a blend of old and new. Much of the original programming API (now referred to as the Classic API) is still usable. But it's been revamped and ...

See more details below
Available through our Marketplace sellers.
Other sellers (Paperback)
  • All (14) from $1.99   
  • New (2) from $25.80   
  • Used (12) from $1.99   
Sort by
Page 1 of 1
Showing All
Note: Marketplace items are not eligible for any coupons and promotions
Seller since 2014

Feedback rating:



New — never opened or used in original packaging.

Like New — packaging may have been opened. A "Like New" item is suitable to give as a gift.

Very Good — may have minor signs of wear on packaging but item works perfectly and has no damage.

Good — item is in good condition but packaging may have signs of shelf wear/aging or torn packaging. All specific defects should be noted in the Comments section associated with each item.

Acceptable — item is in working order but may show signs of wear such as scratches or torn packaging. All specific defects should be noted in the Comments section associated with each item.

Used — An item that has been opened and may show signs of wear. All specific defects should be noted in the Comments section associated with each item.

Refurbished — A used item that has been renewed or updated and verified to be in proper working condition. Not necessarily completed by the original manufacturer.

New New. Unused. Good condition.

Ships from: Scarborough, Canada

Usually ships in 1-2 business days

  • Canadian
  • International
  • Standard, 48 States
  • Standard (AK, HI)
  • Express, 48 States
  • Express (AK, HI)
Seller since 2014

Feedback rating:


Condition: New
Brand new.

Ships from: acton, MA

Usually ships in 1-2 business days

  • Standard, 48 States
  • Standard (AK, HI)
Page 1 of 1
Showing All
Sort by
Sending request ...


This book provides the reader with definitions, details, and explanations of the various components that make up this new operating system. Understanding the operating system helps the reader use the programming tools and the Carbon application programming interface (API) - both of which are covered extensively in this book.

Mac OS X is a blend of old and new. Much of the original programming API (now referred to as the Classic API) is still usable. But it's been revamped and renamed - it's now the Carbon API. This modified set of functions includes plenty of new routines that make a Mac programmer's work easier and more powerful - provided that the programmer knows how to make use of the new code. The reader learns about the all new Carbon Event Manager, as well as the changes and enhancements that have been made to existing managers (such as the Window Manager and the Menu Manager).

Readers new to Mac programming will appreciate the journey that takes them from the start of a new Macintosh project to the final build of a standalone Mac OS X application. Readers experienced in programming the Mac will also find this same material of great interest - and these readers will also benefit from the lengthy section on porting existing Mac OS 8 and 9 applications to Mac OS X. Finally, all readers will appreciate the Carbon API reference section that provides information and example code for dozens of the most commonly used Carbon routines.

Read More Show Less

Product Details

  • ISBN-13: 9780735711686
  • Publisher: Pearson Education
  • Publication date: 11/6/2001
  • Series: Landmark Series
  • Edition number: 1
  • Pages: 362
  • Product dimensions: 7.04 (w) x 8.99 (h) x 0.79 (d)

Meet the Author

Dan Parks Sydow is a software engineer and writer based in Milwaukee, Wisconsin. He has written over twenty computer-related books, including a dozen Macintosh programming books.Whether it's by way of a beginner-level book, such as Mac Programming for Dummies 3rd Edition (IDG Books Worldwide, 1999), or an advanced-level text, such as The Metrowerks CodeWarrior Professional Book (Ventana, 1997), Dan welcomes the opportunity to help others master the art of Macintosh programming.When functioning in the real world (that is, when working in business as opposed to writing), he has worked on Macintosh pro-grams that performed tasks such as the manipulation of hear magnetic resonance (MR) images, and he has designed complex fourth dimension databases that interface Macs to mainframe computers.
Read More Show Less

Read an Excerpt

Chapter 9: QuickTime Movies and File Handling

At this point, you know all about interface elements such as windows, controls, and menus, and you have a firm grasp on how your program recognizes and handles a variety of types of events. So it's on to the fun stuff. In this chapter, you'll see how your program opens and plays a QuickTime movie. QuickTime is movie-playing software that is part of the system software of every Macintosh in your target audience.

It's possible for a program to cause a QuickTime movie to spring forth from (seemingly) nowhere. However, it's more likely that a movie-playing application will enable the user to select the file that holds the movie to play. Giving the user the power to open a QuickTime movie file, or any other type of file, involves the Open dialog box.We'll look at the Open dialog box first in this chapter.

Files and Navigation Services

A file is a sequence of bytes stored on physical media, such as a hard drive, and a directory is another name for a folder. A volume can be an entire physical storage device or it can be part of the device (the result of formatting the device to consist of multiple volumes). For a program to access a file, it needs to know the file's name, the directory in which the file is located, and the volume on which that directory resides. In certain circumstances, a program that's to open a file includes these values (the file name and location) directly within its code, but that's a scenario few programs use. In addition, this hardcoding of file information prevents the user from choosing what file to open, and it also sets up an application failure should the user move or delete the sought-after file.

A better way to handle the situation is to call Navigation Services routines to make use of the Open dialog box. By displaying the Open dialog box, you enable a user to select the file to open. Handling file opening in this way also forces the system to do the work of determining a file's name and location, and it leaves it to the system to convey this important file information to your program.

The Open dialog box provides the user with a standard interface for opening a file. This same Open dialog box is used by any real-world application.You can see it by choosing Open from the File menu of programs such as Apple's TextEdit or by looking at Figure 9.1.

Navigation Services is part of the Carbon API that makes is possible for your programs to include standard dialogs such as the Open dialog box. In addition, it is an important and useful part of the Carbon API. It routines provide interface consistency for the user and removes the burden of file location determination from the programmer. In this chapter, you'll see how to make use of Navigation Services, so brace yourself for a barrage of information about key Navigation Services routines.

Implementing an Open Dialog Box

Yo u 'll make use of a number of Navigation Services routines to display and handle an Open dialog box that is similar to the one TextEdit and other Mac OS X applications use. To do that, your code will perform the following:
1. Create and display the standard Open dialog box.

2. Become aware of the user's action in the Open dialog box.

3. Respond to the user's action (for instance, open the appropriate file if the user clicks the Open button).

4. Clean up by disposing of the Open dialog box when appropriate.

The overall look and behavior of an Open dialog box usually is the same. Such a dialog box includes Cancel and Open buttons and a list view of the folders and files on the user's machine. The general behavior of this type of dialog box is the same from one implementation to another as well; the user navigates through the file list, clicks the name of a file to open within the list, and then clicks the Open button to open the selected file. To promote this consistent look and behavior, Navigation Services defines the NavDialogCreationOptions data structure as the following...

...The NavDialogCreationOptions structure defines the features (such as size and location) of an Open dialog box. The Navigation Services routine NavGetDefaultDialogCreationOptions is used to fill the fields of a NavDialogCreationOptions structure with default values. Use this routine by declaring a variable of type NavDialogCreationOptions and then passing that variable's address as the routine's one argument...

...After setting the values of the members of a structure to default values, you can cus-tomize the structure by changing the value of any individual member. For instance, to make the Open dialog box take over the application and disallow other application actions to take its place, the value of the dialog box's NavDialogCreationOptions modality member can be set to the Apple-defined constant kWindowModalityAppModal:

dialogAttributes.modality =kWindowModalityAppModal;

You 've seen how a program includes an application-defined event handler routine that's associated with a window or other object. The Open dialog box also needs an application-defined event handler routine associated with it. This event handler will be called by the system when the user dismisses the Open dialog box. Navigation Services creates, displays, and runs the Open dialog box, but it is this event handler that should perform the actual work of opening a user-selected file. Like other event handlers, this Open dialog box event handler can have a name of your choosing, but it must include arguments of specific types. Here's the prototype for such a routine...

...In a moment, you'll pass a pointer to this event handler to the Navigation Services routine that creates the Open dialog box. The pointer should be of type NavEventUPP. The UPP in NavEventUPP stands for universal procedure pointer, which is a pointer that is capable of referencing procedures, or routines, in different executable formats. In this case, a NavEventUPP can point to a routine that is in native Mac OS X executable format or in pre-Mac OS X executable format.You'll also need this pointer elsewhere in your program, so declaring this pointer globally makes sense...

NavEventUPP gNavEventHandlerPtr;

Use the Navigation Services routine NewNavEventUPP to set this routine pointer variable to point to the Open dialog box event handler:

gNavEventHandlerPtr =NewNavEventUPP(MyNavEventCallback );

Now it's time to make a call to the Navigation Services routine NavCreateGetFileDialog to create the Open dialog box.This routine requires seven arguments, many of which can typically get set to NULL . Here’s the function prototype...

Read More Show Less

Table of Contents

1 System Components and Programming Technologies 1
2 Overview of Mac OS X Programming 23
3 Events and the Carbon Event Manager 69
4 Windows 103
5 Controls 157
6 Menus 189
7 QuickDraw Graphics 217
8 Text and Localization 239
9 QuickTime Movies and File Handling 255
10 Bundles and Icons 281
11 Porting Mac OS 8/9 Code to Mac OS X 297
A Carbon API Summary 305
B UNIX and the Terminal 325
Index 341
Read More Show Less

Customer Reviews

Average Rating 1
( 1 )
Rating Distribution

5 Star


4 Star


3 Star


2 Star


1 Star


Your Rating:

Your Name: Create a Pen Name or

Barnes & Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation


  • - By submitting a review, you grant to Barnes & and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Terms of Use.
  • - Barnes & reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously
Sort by: Showing 1 Customer Reviews
  • Anonymous

    Posted August 27, 2002

    Beware! No source code provided :-(

    This is an excellent book, but the source code is not provided at the published site referenced in the book. The book says that you can download the accompanying example code at or and neither site actually has the sample code available. There is NOT an accompanying CD provided in this book so check to see if you can find it on the web before buying this book. I like the book and recommend it but the support is less than stellar.

    Was this review helpful? Yes  No   Report this review
Sort by: Showing 1 Customer Reviews

If you find inappropriate content, please report it to Barnes & Noble
Why is this product inappropriate?
Comments (optional)