Previous Book Contents Book Index Next

Inside Macintosh: Macintosh Toolbox Essentials /

Chapter 4 - Window Manager

This chapter describes how your application can use the Window Manager to create and manage windows.

A Macintosh application uses windows for most communication with the user, from discrete interactions like presenting and acknowledging alert boxes to open-ended interactions like creating and editing documents. Users generally type words and formulas, draw pictures, or otherwise enter data in a window on the screen. Your application typically lets the user save this data in a file, open saved files, and view
the saved data in a window.
See the chapter "Introduction to File Management" in
Inside Macintosh: Files for more information about handling files.

A window can be any size or shape, and the user can display any number of windows, within the limits of available memory, on the screen at once.

The Window Manager defines a set of standard windows and provides a set of routines for managing them. The Window Manager helps your application display windows that are consistent with the Macintosh user interface. See Macintosh Human Interface Guidelines for a detailed description of windows and their behavior.

You typically store information about your windows in resources. This chapter describes the standard window resources. For general information on resources, see the chapter "Introduction to the Macintosh Toolbox" in this book. For information on Resource Manager routines, see the chapter "Resource Manager" in Inside Macintosh: More Macintosh Toolbox.

The Window Manager itself depends on QuickDraw, the part of the Macintosh system software that handles quick manipulation of graphics. QuickDraw supports drawing into graphics ports, which are individual and complete drawing environments with independent coordinate systems. Each window represents a graphics port, which is described in Inside Macintosh: Imaging.

To maintain its windows, your application needs to know what actions the user is taking on the desktop. It receives this information through events, which are messages that describe user actions and report on the processing status of your application. This chapter describes the events that affect window display and considers mouse-down and keyboard events as they relate to windows. For a complete description of events and how your application handles them, see the chapter "Event Manager" in this book.

Most document windows contain controls, which are screen images the user manipulates to control the display or the behavior of the application. This chapter illustrates the controls most commonly used in windows. For more information on creating and responding to controls, see the chapter "Control Manager" in this book.

You use the Window Manager to create and display a new window when the user creates a new document or opens an existing document. When the user clicks or holds down the mouse button while the cursor is in a window created by your application, you use the Window Manager to determine the location of the mouse action and to
alter the window display as appropriate. When the user closes a window, you use the Window Manager to remove the window from the screen.

This chapter describes how the Window Manager supports windows and then explains how you can use the Window Manager to

Chapter Contents
Introduction to Windows
Active and Inactive Windows
Types of Windows
Window Regions
Dialog Boxes and Alert Boxes
Windows on the Desktop
About the Window Manager
Graphics Ports
Window Records
Color Windows
Events in Windows
Using the Window Manager
Managing Multiple Windows
Creating a Window
Defining a Window Resource
Creating a Window From a Resource
Positioning a Document Window on the Desktop
Drawing the Window Contents
Updating the Content Region
Maintaining the Update Region
Handling Events in Windows
Handling Mouse Events in Windows
Handling Keyboard Events in Windows
Handling Update Events
Handling Activate Events
Moving a Window
Zooming a Window
Resizing a Window
Closing a Window
Hiding and Showing a Window
Window Manager Reference
Data Structures
The Color Window Record
The Window Record
The Window State Data Record
The Window Color Table Record
The Auxiliary Window Record
The Window List
Window Manager Routines
Initializing the Window Manager
Creating Windows
Naming Windows
Displaying Windows
Retrieving Window Information
Moving Windows
Resizing Windows
Zooming Windows
Closing and Deallocating Windows
Maintaining the Update Region
Setting and Retrieving Other Window Characteristics
Manipulating the Desktop
Manipulating Window Color Information
Low-Level Routines
Application-Defined Routine
The Window Definition Function
The Window Resource
The Window Definition Function Resource
The Window Color Table Resource
Summary of the Window Manager
Pascal Summary
Data Types
Window Manager Routines
Application-Defined Routine
C Summary
Data Types
Window Manager Routines
Application-Defined Routine
Assembly-Language Summary
Data Types
Global Variables

Previous Book Contents Book Index Next

© Apple Computer, Inc.
11 JUL 1996