Home > Store

Carbon Programming

Register your product to gain access to bonus material or receive a coupon.

Carbon Programming


  • Sorry, this book is no longer in print.
Not for Sale


  • Copyright 2001
  • Edition: 1st
  • Book
  • ISBN-10: 0-672-32267-6
  • ISBN-13: 978-0-672-32267-9

Carbon Programming is a comprehensive guide that is logically organized, compatible with the current system software, and includes ready-to-run demonstration programs within each chapter. The book covers Mac programming using the Carbon API. Topics include:

  • Scrap;
  • Event Manager;
  • Appearance Manager;
  • Controls;
  • Lists.

This book is for Mac programmers who are familiar with the C language but who are new to the Carbon API. Professionals coming to the Macintosh and computer science students will benefit from the book as a learning tool relating specifically to the Macintosh computer and the Carbon API.



Carbon Programming Demos - 5,507 kb -- Carbon Programming Demos.sea.hqx

Sample Content

Online Sample Chapter

Carbon API Menu Options Explained

Table of Contents

1. System Software, PowerPC Run-Time Environment, Managing Memory, and Resources.

System Software. PowerPC Run-Time Environment. Managing Memory—Mac OS 8/9. Managing Memory—Mac OS X Considerations. Resources. Main Memory Manager Data Types and Functions. Main Resource Manager Constants, Data Types, and Functions. Demonstration Program SysMemRes Listing. Demonstration Program SysMemRes Comments.

2. The Classic Event Manager—Low-Level and Operating System Events.

The Two Event Managers. Overview of the Classic Event Model. Obtaining Information About Events. Flushing the Operating System Event Queue. Handling Events. Handling Events in Alerts and Dialogs. The 'SIZE' Resource. Main Event Manager Constants, Data Types and Functions. Demonstration Program LowEvents Listing. Demonstration Program LowEvents Comments.

3. Menus.

Introduction—Types of Menus. Pull-Down Menus. Hierarchical Menus. Pop-Up Menus. Menu Objects, Menu IDs and Item Numbers, Command IDs, and Menu Lists. Creating Your Application's Menus. Providing Help Balloons (Mac OS 8/9). Changing Menu Item Appearance. Adding Items to a Menu. Associating Data With Menu Items. Handling Menu Choices. Hiding and Showing the Menu Bar. Accessing Menus From Alerts and Dialogs. Main Menu Manager Constants, Data Types, and Functions. Demonstration Program Menus1 Listing. Demonstration Program Menus1 Comments. Demonstration Program Menus2 Listing. Demonstration Program Menus2 Comments.

4. Introduction to Windows.

Scope of This Chapter. Window Basics. Types of Windows. Window Regions. Controls and Control Lists. The Window List. The Graphics Port and the Window Object. Events in Windows. Creating Your Application's Windows. Managing Multiple Windows and Associated Data. Handling Events. Manipulating Windows. Providing Help Balloons (Mac OS 8/9). Main Window Manager Constants, Data Types, and Functions. Demonstration Program Windows1 Listing. Demonstration Program Windows1 Comments.

5. Carbon and Universal Procedure Pointers.

Introduction. The 68LC040 Emulator and the Mixed Mode Manager. Universal Procedure Pointers and Carbon. Creation/Disposal Functions Relevant to Demonstration Programs.

6. The Appearance Manager.

History. The Appearance Manager. Main Constants, Data Types, and Functions. Demonstration Program Appearance Listing. Demonstration Program Appearance Comments.

7. Introduction to Controls.

Introduction. Standard Controls. The Control Definition Function. The Basic Controls, Primary Group Boxes (Text Title Variant), and User Panes. Activating, Deactivating, Hiding, Showing, Enabling, and Disabling Controls. Visual Feedback from the Basic Controls. Embedding Controls. Getting and Setting Control Data. The Control Object. Creating Controls. Updating, Moving, and Removing Controls. Handling Mouse Events in Controls. Determining and Changing Control Settings, and Getting a Control's Kind. Moving and Resizing Scroll Bars. Scrolling Operations With Scroll Bars. Small Versions of Controls. Main Control Manager Constants, Data Types and Functions Relevant to the Basic Controls, Primary Group Box and User Panes. Demonstration Program Controls1 Listing. Demonstration Program Controls1 Comments. Demonstration Program Controls2 Listing. Demonstration Program Controls2 Comments.

8. Dialogs and Alerts.

Introduction. Alert Types, Modalities, and Levels. Dialog Types and Modalities. Window Types for Alerts and Dialogs. Content of Alerts and Dialogs. Removing Dialogs. Creating and Removing Alerts. Creating Dialogs. Items in Dialogs. Displaying Alerts and Dialogs. Handling Events in Alerts and Dialogs. Closing and Disposing of Dialogs. Creating Displaying and Handling Window-Modal (Sheet) Alerts and Dialogs. Balloon Help for Dialogs—Mac OS 8/9. Help Tags for Dialogs—Mac OS X. Main Dialog Manager Constants, Data Types and Functions. Relevant Window Manager Functions (Mac OS X Only). Demonstration Program DialogAndAlerts Listing. Demonstration Program DialogsAndAlerts Comments.

9. The Finder and the Application.

Introduction. An Application's Required Resources. Application Signature, File Creator, and File Types. Icons for the Finder. File Reference ('FREF') Resources. The Bundle ('BNDL') Resource. The Version ('vers') Resource. Finder Icon Help ('hfdr') Resource—Mac OS 8/9. Missing Application and Application-Missing Resources— Mac OS 8/9. The 'plst' Resource and Information Property Lists. Application Launching by the Finder. The Finder and the Catalog File. Preferences, Temporary Items, and Trash Folders— Using FindFolder. Stationery Pads. Using Aliases. Mac OS 9 Packages and Mac OS X Bundles. Relevant Constants, Data Types, and Functions. Demonstration Programs.

10. Apple Events.

Introduction. Apple Event Attributes and Parameters. Data Structures Within Apple Events. Handling Apple Events. Required Apple Events—Contents and Required Action. Main Apple Event Manager and Appearance Manager Constants, Data Types, and Functions Relevant to Required Apple Events and Appearance Manager Apple Events. Demonstration Program AppleEvents. Demonstration Program AppleEvents Comments.

11. QuickDraw Preliminaries.

QuickDraw and Imaging. RGB Colors and Pixels. Color and the Video Device. Graphics Port. Translation of RGB Colors to Pixel Values. Graphics Devices and GDevice Structures. Other Graphics Managers. Coping with Multiple Monitors. Relevant QuickDraw Constants, Data Types, and Functions. Demonstration Program PreQuickDraw Listing. Demonstration Program PreQuickDraw Comments.

12. Drawing with QuickDraw.

Introduction. The Coordinate Plane, Points, Rectangles, and Regions. The Graphics Pen, Foreground and Background Colors, Pixel Patterns and Bit Patterns, and Transfer Modes. Drawing Lines and Framed Shapes. Drawing Painted and Filled Shapes. Erasing and Inverting Shapes. Drawing Pictures. Drawing Text. Copying Pixel Images Between Graphics Ports. Scrolling Pixels in the Port Rectangle. Manipulating Rectangles and Regions. Highlighting. Drawing Other Graphics Entities. Saving and Restoring the Graphics Port Drawing State. Main QuickDraw Constants, Data Types and Functions. Relevant Appearance Manager Data Types and Functions. Demonstration Program QuickDraw Listing. Demonstration Program QuickDraw Comments.

13. Offscreen Graphics Worlds, Pictures, Cursors, and Icons.

Offscreen Graphics Worlds. Pictures. Cursors. Icons. Main Constants, Data Types and Functions—Offscreen Graphics Worlds. Main Constants, Data Types and Functions—Pictures. Main Constants, Data Types and Functions—Cursors. Appearance Manager Constants, Data Types and Functions—Cursors. Main Constants, Data Types and Functions—Icons. Demonstration Program GworldPicCursIcn Listing. Demonstration Program GWorldPicCursIcn Comments.

14. More on Controls.

Introduction. Control Descriptions. Small Versions of Controls. Idle Processing. Defining Your Own Key Filter Function. Defining Your Own Edit Text Validation Function. Defining Your Own User Pane Functions. Main Constants, Data Types and Functions. Demonstration Program Controls3 Listing. Demonstration Program Controls3 Comments.

15. Carbon Printing.

The Carbon Printing Manager. Printer Drivers. Page and Paper Rectangles. Page Setup Dialogs and Print Dialogs. Printing Sessions—The PMPrintSession Object. The PMPageFormat and PMPrintSettings Objects. Printing a Document. Text on the Screen and the Printed Page. Customizing the Page Setup and Print Dialogs. Displaying Page Setup and Print Dialogs As Window-Modal (Sheet) Dialogs. Saving and Retrieving a Page Format Object. Printing from the Finder—Mac OS 8/9. Main Carbon Printing Manager Constants, Data Types and Functions. Demonstration Program CarbonPrinting Listing. Demonstration Program CarbonPrinting Comments.

16. More on Windows.

Introduction. Floating Windows. Utility and Toolbar Windows. Window Proxy Icons. Window Path Pop-Up Menus. Transitional Window Animation and Sounds. Creating and Storing Windows. Accessing Window Information. Moving and Positioning Windows. Associating Data with Windows. Adding To and Removing From the Update Region. Setting Content Region Color and Pattern. Window Scrolling. The Window Menu. Live Window Resizing. Main Constants, Data Types, and Functions. Demonstration Program Windows2 Listing. Demonstration Program Windows2 Comments.

17. The Carbon Event Manager.

Overview. Event Reference, Class, and Type. Standard Event Handlers. The Application's Event Handlers. Sending and Explicitly Propagating Events. Event Timers. Getting Event Time. Other Aspects of the Carbon Event Model. Main Constants, Data Types, and Functions. Relevant Window Manager Constants and Functions. Demonstration Program CarbonEvents1 Listing. Demonstration Program CarbonEvents1 Comments. Demonstration Program CarbonEvents2 Listing. Demonstration Program CarbonEvents2 Comments.

18. Files and Navigation Services.

Introduction. Files. Navigation Services. Main File Manager Constants, Data Types and Functions. Relevant Resource Manager Functions. Relevant Finder Interface Functions. Main Navigation Services Constants, Data Types, and Functions. Demonstration Program Files Listing. Demonstration Program Files Comments.

19. More on Resources and Core Foundation Preferences.

Introduction. Search Path for Resources. Releasing and Detaching Resources. Creating, Opening, and Closing Resource Forks. Reading and Manipulating Resources. Writing Resources. Partial Resources. Application Preferences. Main Resource Manager Constants, Data Types and Functions. Main Core Foundation Preferences Services Functions. Demonstration Program MoreResources Listing. Demonstration Program MoreResources Comments.

20. Carbon Scrap.

The Carbon Scrap Manager and the Scrap. Private Scrap. TextEdit, Dialogs, and Scrap. Main Carbon Scrap Manager Constants, Data Types, and Functions. Demonstration Program CarbonScrap Listing. Demonstration Program CarbonScrap Comments.

21. Text, Textedit, Dates, Times, and Numbers.

Introduction. More on Text. Introduction to TextEdit. Monostyled TextEdit. Multistyled TextEdit. Formatting and Displaying Dates, Times, and Numbers. Main TextEdit Constants, Data Types and Functions. Main Constants, Data Types and Functions Relating to Dates, Times and Numbers. Demonstration Program MonoTextEdit Listing. Demonstration Program MonoTextEdit Comments. Demonstration Program DateTimeNumbers Listing. Demonstration Program DateTimeNumbers Comments.

22. Lists and Custom List Definition Functions.

Introduction to Lists. Appearance and Features of Lists. Selection of Cells Using the Mouse. Selection of Cells Using the Keyboard. Creating, Disposing of, and Managing Lists. The List Box Control. Custom List Definition Functions. Main List Manager Constants, Data Types, and Functions. Relevant Text Utilities Data Type and Functions. Demonstration Program Lists Listing. Demonstration Program Lists Comments.

23. Drag and Drop.

Overview. Drag Items, Drag Item Flavors, and Handlers. The Drag Region and The Drag Image. Drag Functions—Overriding Drag Manager Default Behavior. Main Drag Manager Constants, Data Types, and Functions. Relevant TextEdit Function. Demonstration Program Drag Listing. Demonstration Program Drag Comments.

24. Basic Sound and Speech.

Introduction to Sound. Sound Production. Sound Recording—Mac OS 8/9. Speech. Relevant Constants, Data Types, and Functions. The AsynchSoundLib Library. Demonstration Program SoundAndSpeech Listing. Demonstration Program SoundAndSpeech Comments.

25. Miscellany.

Notification From Applications in the Background. Progress Bars Command-Period Key-Down Events, and Mouse-Down Events. The Color Picker. Coping with Multiple Monitors. Help Tags. Ensuring Compatibility with the Operating Environment. Carbon and Available APIs. Main Notification Manager Data Types and Functions. Relevant Process Manager Data Types and Functions. Relevant Event Manager Function. Relevant Color Picker Utilities Function. Relevant QuickDraw Function. Relevant Window Manager Function. Main Help Package Constants, Data Types, and Functions. Relevant Gestalt Manager Function. Demonstration Program Miscellany Listing. Demonstration Program Miscellany Comments.

26. More on Text—Multilingual Text Engine.

Introduction. Working with MLTE. Main Constants, Data Types, and Functions. Demonstration Program MLTETextEditor Listing. Demonstration Program MLTETextEditor Comments.



Updates & Corrections

NOTE: The updates and corrections to this book are viewable using Adobe's Acrobat Reader. If you have the Acrobat Reader installed, click on the link to open up a new window and automatically launch Acrobat Reader. If you do not have the Acrobat Reader installed, please go to Adobe's website to download and install the Acrobat Reader before attempting to view the updates and corrections.
Updates and corrections (Jan. 2002) - 1,100 kb -- Updates and Corrections.pdf

Submit Errata

More Information

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information

To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.


Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.


If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information

Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.


This site is not directed to children under the age of 13.


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information

If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information

Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents

California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure

Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact

Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice

We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020