Kit’s basic architecture is primarily implemented in
. Figure 3-3 shows the
class hierarchy for these classes. Individually, these three classes
provide the means for an application to interface with the operating
system (and ultimately, the user) via connections to
Quartz, the window
server, and underlying Unix libraries through Core Foundation. Taken
as a whole, these classes form the backbone of the Application
Kit’s event-handling infrastructure.
Figure 3-3. The hierarchical relationship between NSApplication, NSWindow, and NSView; these three classes all have a common parent in NSResponder
Fundamental to every Cocoa application is a singleton instance of
NSApplication (accessible by using the class
sharedApplication or the global variable,
provides a link to the window server and
other essential operating system services. One of its most important
responsibilities is management of the application’s
run loop and event handling.
have the job of managing input from sources such as the mouse and
keyboard (through the window server), ports, and timers. As the owner
of the application’s main run loop,
NSApplication is the first stop for event
processing in an application. Through a direct connection to the
NSApplication accepts ...