The Screen Saver framework defines the interface for subclasses to interact with the Screen Effects user interface feature. Screen Effects modules need to be written in Objective-C with its user interface implemented using Cocoa.
Screen Saver Framework Classes
The Screen Saver framework consists of the ScreenSaverView class, an abstract subclass of NSView. ScreenSaverView defines an interface for animating screen savers, instantiating small preview versions of the screen saver view (for display in the system preferences, for example), and for providing a configuration sheet to set various properties of the screen saver.
The ScreenSaverDefaults class is a subclass of NSUserDefaults and provides an interface to the standard user preferences storage system.
In addition, the Screen Saver framework provides a number of functions commonly required by screen saver applications including producing random values and centering rectangles.
When OS X starts your screen saver, the following things happen:
The screen fades to black.
Your module is instantiated and its
initroutine is called.
The window is created.
Your module is installed in the window.
Your window is activated and its order is set. The
drawRectcall is called at this point.
The screen fades in, revealing your window in the front.
startAnimationmethod is called. This method should not do any drawing.
Drawing continues. Your
animateOneFrameis called repeatedly.
The user takes some action.
stopAnimationmethod is called.
Because screen savers are plug-ins for the screen saver engine, a screen saver can only be supported if its binary contains a slice for the architecture of the running engine. As with any application, the screen saver engine normally runs using the most recent architecture supported by a given computer (assuming that the engine has a slice for that architecture).
For full compatibility, this means that on Intel-based Macs, a screen saver must contain (at least) an i386 slice (compiled for the oldest OS version you wish to support) and an x86_64 slice (compiled for version 10.6 and later). On PowerPC, OS X uses a 32-bit screen saver engine.
ScreenSaverDefaults defines a set of methods for saving and restoring user defaults for screen savers.
ScreenSaverView is an abstract class that defines the interface for subclassers to interact with the screen saver infrastructure.