Copyright ã1994 by NeXT Computer, Inc.  All Rights Reserved.

NSScreen 

Inherits From:	NSObject

Conforms To:	NSObject (NSObject)

Declared In:	AppKit/NSScreen.h 

Class Description

An NSScreen object describes the attributes of a computer's monitor, or screen. An application may use an NSScreen object to retrieve information about a screen and use this information to decide what to display upon that screen. For example, an application may use the deepestScreen method to find out which of the available screens can best represent color and then may choose to display all of its windows on that screen. 

The two main attributes of a screen are its depth and its dimensions. The depth method describes the screen depth (such as two-bit, eight-bit, or twelve-bit) and tells you if the screen can display color. The frame method gives the screen's dimensions and location as an NSRect. 

The device description dictionary contains more complete information about the screen. Use NSScreen's deviceDescription method to access the dictionary, and use these keys to retrieve information about a screen:

Dictionary Key	Returns

NSDeviceResolution	An NSValue describing the screen's resolution in dots per inch (dpi).

NSDeviceColorSpaceName	The screen's color space name. See NSGraphics.h for a list of possible values.

NSDeviceBitsPerSample	The bit depth of screen images (2-bit, 8-bit, etc.). 

NSDeviceIsScreen	YES, indicating the device is a screen.

NSDeviceSize	An NSValue describing the screen's size in points.

The device description dictionary contains information about not only screens, but all other system devices such as printers and windows. There are other keys into the dictionary that you would use to obtain information about these other devices. For a complete list of device dictionary keys, see NSGraphics.h.

Creating NSScreen Instances

+ (NSScreen *)mainScreen	Returns an NSScreen object representing the main screen. The main screen is the screen with the key window.

+ (NSScreen *)deepestScreen	Returns an NSScreen object representing the screen that can best represent color. This method always returns an object, even if there is only one screen and it is not a color screen. 

+ (NSArray *)screens	Returns an array of NSScreen objects representing all of the screens available on the system. Raises NSWindowServerCommunicationException if the screens information can't be obtained from the window system.

Reading Screen Information

- (NSWindowDepth)depth	Returns the screen's depth, including whether the screen can display color.

- (NSRect)frame	Returns the dimensions and location of the screen in an NSRect.

- (NSDictionary *)deviceDescription	Returns the device dictionary as described in the class description.