Chapter 6. Windows, Views, and Controls
All of the objects that you interact with on your computer screen are displayed within windows. This includes what we consider “normal” windows (those with titlebars and controls), as well as menu items, pop-up contextual menus, floating palettes, sheets, drawers, and the Dock.
Windows and the Window System
Two interacting systems create and manage Cocoa windows. On one hand, Mac OS X’s window server creates a window and displays it on screen. The window server is a process that uses Quartz—the low-level drawing system—to draw, resize, hide, and move windows. As depicted in Figure 6-1, the window server also detects users events (such as mouse clicks or keyboard key presses) and forwards them to applications.
On the other hand, the window created by the window server is paired
with an object supplied by the AppKit—an instance of the
NSWindow
class. Each physical window in a Cocoa
program is managed by an instance of NSWindow
or a
subclass. As shown in Figure 6-2, when an
NSWindow
object is created, the window server
creates the physical window being managed. The window server
references the window by its window number and the
NSWindow
object instance by its own identifier.
Get Learning Cocoa with Objective-C, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.