Carbon Programming
暫譯: 碳程式設計

Kevin Bricknell

  • 出版商: SAMS
  • 出版日期: 2001-10-18
  • 定價: $1,650
  • 售價: 6.0$990
  • 語言: 英文
  • 頁數: 1608
  • 裝訂: Paperback
  • ISBN: 0672322676
  • ISBN-13: 9780672322679
  • 相關分類: C 程式語言MAC OS 蘋果電腦
  • 立即出貨(限量) (庫存=4)

買這商品的人也買了...

商品描述

 

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.

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.


Index.

商品描述(中文翻譯)

《Carbon Programming》是一本全面的指南,邏輯組織良好,與當前系統軟體相容,並在每一章中包含可立即運行的示範程式。該書涵蓋了使用 Carbon API 的 Mac 程式設計。主題包括:

- 剪貼簿 (Scrap)
- 事件管理器 (Event Manager)
- 外觀管理器 (Appearance Manager)
- 控制項 (Controls)
- 列表 (Lists)

本書適合熟悉 C 語言但對 Carbon API 新手的 Mac 程式設計師。專業人士轉向 Macintosh 以及計算機科學學生將從本書中獲益,作為與 Macintosh 電腦和 Carbon API 相關的學習工具。

**目錄**

1. 系統軟體、PowerPC 執行環境、記憶體和資源管理
- 系統軟體。PowerPC 執行環境。記憶體管理—Mac OS 8/9。記憶體管理—Mac OS X 考量。資源。主記憶體管理器資料類型和函數。主資源管理器常數、資料類型和函數。示範程式 SysMemRes 列表。示範程式 SysMemRes 註解。

2. 經典事件管理器—低階和作業系統事件
- 兩個事件管理器。經典事件模型概述。獲取事件資訊。清空作業系統事件佇列。處理事件。在警示和對話框中處理事件。'SIZE' 資源。主事件管理器常數、資料類型和函數。示範程式 LowEvents 列表。示範程式 LowEvents 註解。

3. 菜單
- 介紹—菜單類型。下拉菜單。層級菜單。彈出菜單。菜單物件、菜單 ID 和項目編號、命令 ID 和菜單列表。創建應用程式的菜單。提供幫助氣泡 (Mac OS 8/9)。更改菜單項目外觀。向菜單添加項目。將資料與菜單項目關聯。處理菜單選擇。隱藏和顯示菜單欄。從警示和對話框訪問菜單。主菜單管理器常數、資料類型和函數。示範程式 Menus1 列表。示範程式 Menus1 註解。示範程式 Menus2 列表。示範程式 Menus2 註解。

4. 窗口介紹
- 本章範圍。窗口基礎。窗口類型。窗口區域。控制項和控制項列表。窗口列表。圖形端口和窗口物件。窗口中的事件。創建應用程式的窗口。管理多個窗口和相關資料。處理事件。操作窗口。提供幫助氣泡 (Mac OS 8/9)。主窗口管理器常數、資料類型和函數。示範程式 Windows1 列表。示範程式 Windows1 註解。

5. Carbon 和通用程序指標
- 介紹。68LC040 模擬器和混合模式管理器。通用程序指標和 Carbon。與示範程式相關的創建/處置函數。

6. 外觀管理器
- 歷史。外觀管理器。主要常數、資料類型和函數。示範程式 Appearance 列表。示範程式 Appearance 註解。

7. 控制項介紹
- 介紹。標準控制項。控制項定義函數。基本控制項、主要組框 (文本標題變體) 和用戶面板。啟用、停用、隱藏、顯示、啟用和禁用控制項。基本控制項的視覺反饋。嵌入控制項。獲取和設置控制項資料。控制項物件。創建控制項。更新、移動和移除控制項。在控制項中處理滑鼠事件。確定和更改控制項設置,獲取控制項的類型。移動和調整滾動條大小。使用滾動條進行滾動操作。控制項的小版本。與基本控制項、主要組框和用戶面板相關的主控制項管理器常數、資料類型和函數。示範程式 Controls1 列表。示範程式 Controls1 註解。示範程式 Controls2 列表。示範程式 Controls2 註解。

8. 對話框和警示
- 介紹。警示類型、模式和級別。對話框類型和模式。警示和對話框的窗口類型。警示和對話框的內容。移除對話框。創建和移除警示。創建對話框。對話框中的項目。顯示警示和對話框。在警示和對話框中處理事件。關閉和處置對話框。創建、顯示和處理窗口模式 (表單) 警示和對話框。對話框的氣泡幫助—Mac OS 8/9。對話框的幫助標籤—Mac OS X。主對話框管理器常數、資料類型和函數。相關的窗口管理器函數 (僅限 Mac OS X)。示範程式 DialogAndAlerts 列表。示範程式 DialogsAndAlerts 註解。

9. Finder 和應用程式
- 介紹。應用程式所需的資源。應用程式簽名、檔案創建者和檔案類型。Finder 的圖示。檔案參考 ('FREF') 資源。包 ('BNDL') 資源。版本 ('vers') 資源。Finder 圖示幫助 ('hfdr') 資源—Mac OS 8/9。缺失的應用程式和缺失的應用程式資源—Mac OS 8/9。'plst' 資源和資訊屬性列表。Finder 啟動應用程式。Finder 和目錄檔案。偏好設定、臨時項目和垃圾桶—使用 FindFolder。文具墊。使用別名。Mac OS 9 套件和 Mac OS X 包。相關的常數、資料類型和函數。示範程式。

10. Apple 事件
- 介紹。Apple 事件屬性和參數。Apple 事件中的資料結構。處理 Apple 事件。所需的 Apple 事件—內容和所需操作。主要 Apple 事件管理器和外觀管理器常數、資料類型和函數,與所需的 Apple 事件和外觀管理器 Apple 事件相關。示範程式 AppleEvents。示範程式 AppleEvents 註解。

11. QuickDraw 基礎
- QuickDraw 和影像。RGB 顏色和像素。顏色和視頻設備。圖形端口。RGB 顏色轉換為像素值。圖形設備和 GDevice 結構。其他圖形管理器。處理多顯示器。相關的 QuickDraw 常數、資料類型和函數。示範程式 PreQuickDraw 列表。示範程式 PreQuickDraw 註解。

12. 使用 QuickDraw 繪圖
- 介紹。坐標平面、點、矩形和區域。圖形筆、前景和背景顏色、像素圖案和位圖模式,以及轉換模式。繪製線條和框形。繪製塗色和填充形狀。擦除和反轉形狀。繪製圖片。繪製文本。在圖形端口之間複製像素影像。在端口矩形中滾動像素。操作矩形和區域。高亮顯示。繪製其他圖形實體。保存和恢復圖形端口繪圖狀態。主要 QuickDraw 常數、資料類型和函數。相關的外觀管理器資料類型和函數。示範程式 QuickDraw 列表。示範程式 QuickDraw 註解。

13. 畫面外圖形世界、圖片、游標和圖示
- 畫面外圖形世界。圖片。游標。圖示。主要常數、資料類型和函數—畫面外圖形世界。主要常數、資料類型和函數—圖片。主要常數、資料類型和函數—游標。外觀管理器常數、資料類型和函數—游標。主要常數、資料類型和函數—圖示。示範程式 GworldPicCursIcn 列表。示範程式 GWorldPicCursIcn 註解。

14. 更多控制項
- 介紹。控制項描述。控制項的小版本。閒置處理。定義自己的鍵盤過濾函數。定義自己的編輯文本驗證函數。定義自己的用戶面板函數。主要常數、資料類型和函數。示範程式 Controls3 列表。示範程式 Controls3 註解。

15. Carbon 列印
- Carbon 列印管理器。印表機驅動程式。頁面和紙張矩形。頁面設置對話框和列印對話框。列印會話—PMPrintSession 物件。PMPageFormat 和 PMPrintSettings 物件。列印文件。螢幕上的文本和列印頁面。自定義頁面設置和列印對話框。將頁面設置和列印對話框顯示為窗口模式 (表單) 對話框。保存和檢索頁面格式物件。從 Finder 列印—Mac OS 8/9。主要 Carbon 列印管理器常數、資料類型和函數。示範程式 CarbonPrinting 列表。示範程式 CarbonPrinting 註解。

16. 更多窗口
- 介紹。浮動窗口。工具和工具列窗口。窗口代理圖示。窗口路徑彈出菜單。過渡窗口動畫和聲音。創建和存儲窗口。訪問窗口資訊。移動和定位窗口。將資料與窗口關聯。添加到更新區域和從更新區域移除。設置內容區域顏色和圖案。窗口滾動。窗口菜單。實時窗口調整大小。主要常數、資料類型和函數。示範程式 Windows2 列表。示範程式 Windows2 註解。

17. Carbon 事件管理器
- 概述。事件參考、類別和類型。標準事件處理器。應用程式的事件處理器。發送和明確傳播事件。事件計時器。獲取事件時間。Carbon 事件模型的其他方面。主要常數、資料類型和函數。相關的窗口管理器常數和函數。示範程式 CarbonEvents1 列表。示範程式 CarbonEvents1 註解。示範程式 CarbonEvents2 列表。示範程式 CarbonEvents2 註解。

18. 檔案和導航服務
- 介紹。檔案。導航服務。主要檔案管理器常數、資料類型和函數。相關的資源管理器函數。相關的 Finder 介面函數。主要導航服務常數、資料類型和函數。示範程式 Files 列表。示範程式 Files 註解。

19. 更多資源和核心基礎偏好設定
- 介紹。資源的搜尋路徑。釋放和分離資源。創建、打開和關閉資源分支。讀取和操作資源。寫入資源。部分資源。應用程式偏好設定。主要資源管理器常數、資料類型和函數。主要核心基礎偏好服務函數。示範程式 MoreResources 列表。示範程式 MoreResources 註解。

20. Carbon 剪貼簿
- Carbon 剪貼簿管理器和剪貼簿。私有剪貼簿。TextEdit、對話框和 S