Framework | AppKit/AppKit.h |
Declared in | NSAccessibility.h NSApplication.h NSCell.h NSEvent.h NSFont.h NSGraphics.h NSInterfaceStyle.h NSKeyValueBinding.h NSOpenGL.h NSPanel.h NSPasteboard.h |
This document describes functions and function-like macros defined in the Application Kit framework.
Additional information on accessibility can be found in NSAccessibility
.
NSAccessibilityActionDescription
NSAccessibilityPostNotification
NSAccessibilityRaiseBadArgumentException
NSAccessibilityRoleDescription
NSAccessibilityRoleDescriptionForUIElement
NSAccessibilityUnignoredChildren
NSAccessibilityUnignoredChildrenForOnlyChild
NSAccessibilityUnignoredDescendant
NSAccessibilityUnignoredAncestor
Additional information on NSApplication
can be found in NSApplication Class Reference.
NSApplicationLoad
NSApplicationMain
NSPerformService
NSRegisterServicesProvider
NSSetShowsServicesMenuItem
NSShowsServicesMenuItem
NSUnregisterServicesProvider
NSUpdateDynamicServices
NSCopyBits
NSCountWindows
NSCountWindowsForContext
NSDisableScreenUpdates
NSEnableScreenUpdates
NSDottedFrameRect
NSDrawBitmap
NSDrawButton
NSDrawDarkBezel
NSDrawGrayBezel
NSDrawGroove
NSDrawLightBezel
NSDrawThreePartImage
NSDrawNinePartImage
NSDrawTiledRects
NSDrawColorTiledRects
NSDrawWhiteBezel
NSDrawWindowBackground
NSEraseRect
NSFrameRect
NSFrameRectWithWidth
NSFrameRectWithWidthUsingOperation
NSGetWindowServerMemory
NSHighlightRect
NSReadPixel
NSRectClip
NSRectClipList
NSRectFill
NSRectFillList
NSRectFillListWithColors
NSRectFillListWithGrays
NSRectFillListUsingOperation
NSRectFillListWithColorsUsingOperation
NSRectFillUsingOperation
NSSetFocusRingStyle
NSShowAnimationEffect
NSWindowList
NSWindowListForContext
NSAvailableWindowDepths
NSBestDepth
NSBitsPerPixelFromDepth
NSBitsPerSampleFromDepth
NSColorSpaceFromDepth
NSNumberOfColorComponents
NSPlanarFromDepth
NSBeginAlertSheet
NSBeginCriticalAlertSheet
NSBeginInformationalAlertSheet
NSGetAlertPanel
NSGetCriticalAlertPanel
NSGetInformationalAlertPanel
NSReleaseAlertPanel
NSRunAlertPanel
NSRunCriticalAlertPanel
NSRunInformationalAlertPanel
Additional information on sounds can be found in NSSound
.
Returns a standard description for an action.
NSString * NSAccessibilityActionDescription ( NSString *action );
This function returns a standard description for action.
NSAccessibility.h
Sends a notification to any observing assistive applications.
void NSAccessibilityPostNotification ( id element, NSString *notification );
Sends notification to any assistive applications that have registered to receive the notification from the user interface object element in your application. Accessibility notifications require special handling, so they cannot be posted using NSNotificationCenter
.
NSAccessibility.h
Raises an error if the parameter is the wrong type or has an illegal value
void NSAccessibilityRaiseBadArgumentException ( id element, NSString *attribute, id value );
Raises an error if a parameter is the wrong type or has an illegal value. This function can also be used to raise an error if an attempt is made to set an attribute's value with the wrong type or an illegal value.
NSAccessibility.h
Returns a standard description for a role and subrole.
NSString * NSAccessibilityRoleDescription ( NSString *role, NSString *subrole );
You should pass nil to this function if there is no subrole. This function returns a description of a standard role. For example, if you implement a button widget that does not inherit from NSButton
, you should use this function to return a localized role description matching that returned by a standard button.
NSAccessibility.h
Returns a standard role description for a user interface element.
NSString * NSAccessibilityRoleDescriptionForUIElement ( id element );
This function is like the NSAccessibilityRoleDescription
function, except that it queries element to get the role and subrole. The NSAccessibilityRoleDescription
function is more efficient, but this function is useful for accessorizing base classes so that they properly handle derived classes, which may override the subrole or even the role.
NSAccessibility.h
Returns an unignored accessibility object, ascending the hierarchy if necessary.
id NSAccessibilityUnignoredAncestor ( id element );
Tests whether element is an ignored object, returning either element, if it is not ignored, or the first unignored ancestor of element.
NSAccessibility.h
Returns a list of unignored accessibility objects, descending the hierarchy if necessary.
NSArray * NSAccessibilityUnignoredChildren ( NSArray *originalChildren );
Returns a copy of originalChildren with any ignored objects in the array replaced by their unignored descendants.
NSAccessibility.h
Returns a list of unignored accessibility objects, descending the hierarchy if necessary.
NSArray * NSAccessibilityUnignoredChildrenForOnlyChild ( id originalChild );
Tests whether originalChild is an ignored object and returns an array containing either originalChild, if it is not ignored, or its unignored descendants.
NSAccessibility.h
Returns an unignored accessibility object, descending the hierarchy if necessary.
id NSAccessibilityUnignoredDescendant ( id element );
Tests whether element is an ignored object, returning either element, if it is not ignored, or the first unignored descendant of element. Use this function only if you know there is a linear, one-to-one, hierarchy below element. Otherwise, if element has either no unignored children or multiple unignored children, this function fails and returns nil
.
NSAccessibility.h
Startup function to call when running Cocoa code from a Carbon application.
BOOL NSApplicationLoad (void);
YES
if the NSApplication
object was successfully initialized and can now be used from your Carbon application or NO
if there was an error during initialization.
You typically call this function before calling other Cocoa code in a plug-in loaded into a primarily Carbon application. If the shared NSApplication
object is not already initialized, this function initializes it and sets up the necessary event handlers for Cocoa.
NSApplication.h
Called by the main function to create and run the application.
int NSApplicationMain ( int argc, const char *argv[] );
The number of arguments in the argv parameter.
An array of pointers containing the arguments that were passed to the application at startup.
This method never returns a result code. Instead, it calls the exit
function to exit the application and terminate the process. If you want to determine why the application exited, you should look at the result code from the exit
function instead.
Creates the application, loads the main nib file from the application’s main bundle, and runs the application. You must call this function from the main thread of your application, and you typically call it only once from your application’s main
function, which is usually generated automatically by Xcode.
NSApplicationMain
itself ignores the argc and argv arguments. Instead, Cocoa gets its arguments indirectly via _NSGetArgv
, _NSGetArgc
, and _NSGetEnviron
(see <crt_externs.h>).
NSApplication.h
Returns the available window depth values.
const NSWindowDepth * NSAvailableWindowDepths (void);
Returns a null-terminated array of NSWindowDepthâWindow Depth
values that specify which window depths are currently available. Window depth values are converted to specific display properties using the functions NSBitsPerPixelFromDepth
, NSBitsPerSampleFromDepth
, NSColorSpaceFromDepth
, and NSPlanarFromDepth
.
NSGraphics.h
Plays the system beep.
void NSBeep (void);
Plays the system beep. Users can select a sound to be played as the system beep. On a Macintosh computer, for example, you can change sounds with the Sound pane of System Preferences.
NSGraphics.h
Creates and runs an alert sheet.
void NSBeginAlertSheet ( NSString *title, NSString *defaultButton, NSString *alternateButton, NSString *otherButton, NSWindow *docWindow, id modalDelegate, SEL didEndSelector, SEL didDismissSelector, void *contextInfo, NSString *msg, ... );
Creates and runs an alert sheet on docWindow, with the title of title, the text of msg, and buttons with titles of defaultButton, alternateButton, and otherButton.
The buttons are laid out on the lower-right corner of the sheet, with defaultButton on the right, alternateButton on the left, and otherButton in the middle. If title is nil
or an empty string, a default localized title is used (“Alert” in English). If defaultButton is nil
or an empty string, a default localized button title (“OK” in English) is used. For the remaining buttons, this function creates them only if their corresponding button title is non-nil
.
A Command-D key equivalent for the “Don’t Save” button is provided, if one is found. The button titles are searched for the localized value for “Don’t Save.” If a match is found, that button is assigned a Command-D key equivalent, provided it is not the default button.
If you create a modal panel using runModalForWindow:
or beginSheet:modalForWindow:modalDelegate:didEndSelector:contextInfo:
, you can assign the key equivalent yourself, using setKeyEquivalent:
and setKeyEquivalentModifierMask:
.
The msg argument is the message that’s displayed in the panel. It can use printf-style formatting characters; any necessary arguments should be listed at the end of the function’s argument list (after the msg argument). For more information on formatting characters, see the man page for printf
.
When the modal session is ended, and before the sheet is dismissed, the didEndSelector is invoked on the modalDelegate. passing contextInfo. After the sheet is dismissed, the didDismissSelector is invoked on the modalDelegate, passing contextInfo. Typically, you will want to implement the didEndSelector but you may pass NULL
for the didDismissSelector. The two selectors should be defined as follows:
sheetDidEnd:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo; |
sheetDidDismiss:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo; |
where sheet is the alert sheet, returnCode specifies which button the user pressed, and contextInfo is the same contextInfo passed into NSBeginAlertSheet
. returnCode can be one of the following:
NSAlertDefaultReturn
means the user pressed the default button.
NSAlertAlternateReturn
means the user pressed the alternate button.
NSAlertOtherReturn
means the user pressed the other button.
NSAlertErrorReturn
means an error occurred while running the alert panel.
NSPanel.h
Creates and runs a critical alert sheet.
void NSBeginCriticalAlertSheet ( NSString *title, NSString *defaultButton, NSString *alternateButton, NSString *otherButton, NSWindow *docWindow, id modalDelegate, SEL didEndSelector, SEL didDismissSelector, void *contextInfo, NSString *msg, ... );
Creates and runs a critical alert sheet on docWindow, with the title of title, the text of msg, and buttons with titles of defaultButton, alternateButton, and otherButton.
See the description of NSBeginAlertSheet
for information on layout, default parameters, and the selectors.
The sheet presented to the user is badged with a caution icon. Critical alerts should be used only as specified in the "Alerts” section of the Windows chapter of Apple Human Interface Guidelines.
NSPanel.h
Creates and runs an informational alert sheet.
void NSBeginInformationalAlertSheet ( NSString *title, NSString *defaultButton, NSString *alternateButton, NSString *otherButton, NSWindow *docWindow, id modalDelegate, SEL didEndSelector, SEL didDismissSelector, void *contextInfo, NSString *msg, ... );
Creates and runs an informational alert sheet on docWindow, with the title of title, the text of msg, and buttons with titles of defaultButton, alternateButton, and otherButton.
See the description of NSBeginAlertSheet
for information on layout, default parameters, and the selectors.
NSPanel.h
Attempts to return a window depth adequate for the specified parameters.
NSWindowDepth NSBestDepth ( NSString *colorSpace, NSInteger bps, NSInteger bpp, BOOL planar, BOOL *exactMatch );
Returns a window depth deep enough for the given number of colors in colorSpace, bits per sample specified by bps, bits per pixel specified by bpp, and whether planar as specified by planar. Upon return, the variable pointed to by exactMatch is YES
if the window depth can accommodate all of the values specified by the parameters, NO
if it can’t.
Use this function to compute window depths. This function tries to accommodate all the parameters (match or better); if there are multiple matches, it gives the closest, with matching colorSpace first, then bps, then planar, then bpp. bpp is “bits per pixel”; 0 indicates default (same as the number of bits per plane, either bps or bps
* NSNumberOfColorComponents
); other values may be used as hints to provide backing stores of different configuration; for instance, 8-bit color. The exactMatch parameter is optional and indicates whether all the parameters matched exactly.
NSGraphics.h
Returns the bits per pixel for the specified window depth.
NSInteger NSBitsPerPixelFromDepth ( NSWindowDepth depth );
Returns the number of bits per pixel for the window depth specified by depth.
NSGraphics.h
Returns the bits per sample for the specified window depth.
NSInteger NSBitsPerSampleFromDepth ( NSWindowDepth depth );
Returns the number of bits per sample (bits per pixel in each color component) for the window depth specified by depth.
NSGraphics.h
Returns the name of the color space corresponding to the passed window depth.
NSString * NSColorSpaceFromDepth ( NSWindowDepth depth );
Returns the color space name for the specified depth. For example, the returned color space name can be NSCalibratedRGBColorSpace
, or NSDeviceCMYKColorSpace
.
NSGraphics.h
Prepares a set of glyphs for processing by character-based routines.
NSInteger NSConvertGlyphsToPackedGlyphs ( NSGlyph *glBuf, NSInteger count, NSMultibyteGlyphPacking packing, char *packedGlyphs );
Takes a buffer of glyphs, specified in the glBuf parameter, and packs them into a condensed character array. The character array is returned in the packedGlyphs parameter, which should have enough space for at least ((4 * count) + 1) bytes to guarantee that the packed glyphs fit. count specifies the number of glyphs in glBuf. packing specifies how the glyphs are currently packed.
NSFont.h
Copies a bitmap image to the location specified by a destination point.
void NSCopyBits ( NSInteger srcGState, NSRect srcRect, NSPoint destPoint );
Copies the pixels in the rectangle specified by srcRect to the location specified by destPoint. The source rectangle is defined in the graphics state designated by srcGState. If srcGState is NSNullObject
, the current graphics state is assumed. The destPoint destination is defined in the current graphics state.
NSGraphics.h
Counts the number of onscreen windows.
void NSCountWindows ( NSInteger *count );
On output, this parameter contains the number of onscreen windows.
NSGraphics.h
Counts the number of onscreen windows belonging to a particular application.
void NSCountWindowsForContext ( NSInteger context, NSInteger *count );
Counts the number of onscreen windows belonging to a particular application, identified by context, which is a window server connection ID. The function returns the number by reference in count.
Use of this function is discouraged as it may be deprecated in a future release.
NSGraphics.h
Returns a pasteboard type based on the passed file type.
NSString * NSCreateFileContentsPboardType ( NSString *fileType );
Returns an NSString to a pasteboard type representing a file’s contents based on the supplied string fileType. fileType should generally be the extension part of a filename. The conversion from a named file type to a pasteboard type is simple; no mapping to standard pasteboard types is attempted.
NSPasteboard.h
Returns a pasteboard type based on the passed file type.
NSString * NSCreateFilenamePboardType ( NSString *fileType );
Returns an NSString
to a pasteboard type representing a filename based on the supplied string fileType.
NSPasteboard.h
Disables screen updates.
void NSDisableScreenUpdates (void);
Prevents drawing operations from being flushed to the screen for all windows belonging to the calling process. When you re-enable screen updates (with NSEnableScreenUpdates
) screen flushing for all windows belonging to the calling process appears to be simultaneous. You typically call this function so that operations on multiple windows appear atomic to the user. This is a technique particularly useful for synchronizing parent and child windows. Make sure that the period after calling this function and before reenabling updates is short; the system only allow updating to be disabled for a limited time (currently one second) before automatically reenabling updates. Successive calls to this function are placed on a stack and must be popped off that stack by matching NSEnableScreenUpdates
calls.
NSGraphics.h
Draws a bordered rectangle.
void NSDottedFrameRect ( NSRect aRect );
Deprecated. Use a dashed NSBezierPath
instead.
NSGraphics.h
Draws a bitmap image.
void NSDrawBitmap ( NSRect rect, NSInteger width, NSInteger height, NSInteger bps, NSInteger spp, NSInteger bpp, NSInteger bpr, BOOL isPlanar, BOOL hasAlpha, NSString *colorSpaceName, const unsigned char *const data[5] );
This function is marginally obsolete. Most applications are better served using the NSBitmapImageRep
class to read and display bitmap images.
This function renders an image from a bitmap, binary data that describes the pixel values for the image.
This function renders a bitmap image using an appropriate display operator. It puts the image in the rectangular area specified by its first argument, rect; the rectangle is specified in the current coordinate system and is located in the current window. The next two arguments, pixelsWide and pixelsHigh, give the width and height of the image in pixels. If either of these dimensions is larger or smaller than the corresponding dimension of the destination rectangle, the image will be scaled to fit.
The remaining arguments describe the bitmap data, as explained in the following paragraphs.
The bitsPerSample argument is the number of bits per sample for each pixel and samplesPerPixel is the number of samples per pixel. bitsPerPixel is based on samplesPerPixel and the configuration of the bitmap: if the configuration is planar, then the value of bitsPerPixel should equal the value of bitsPerSample; if the configuration isn’t planar (is meshed instead), bitsPerPixel should equal bitsPerSample * samplesPerPixel
.
The bytesPerRow argument is calculated in one of two ways, depending on the configuration of the image data (data configuration is described below). If the data is planar, bytesPerRow is (7 + (pixelsWide * bitsPerSample)) / 8
. If the data is meshed, bytesPerRow is (7 + (pixelsWide * bitsPerSample * samplesPerPixel)) / 8
.
A sample is data that describes one component of a pixel. In an RGB color system, the red, green, and blue components of a color are specified as separate samples, as are the cyan, magenta, yellow, and black components in a CMYK system. Color values in a grayscale are a single sample. Alpha values that determine transparency and opaqueness are specified as a coverage sample separate from color. In bitmap images with alpha, the color (or gray) components have to be premultiplied with the alpha. This is the way images with alpha are displayed, this is the way they are read back, and this is the way they are stored in TIFFs.
The isPlanar argument refers to the way data is configured in the bitmap. This flag should be set to YES
if a separate data channel is used for each sample. The function provides for up to five channels, data1, data2, data3, data4, and data5. It should be set NO
if sample values are interwoven in a single channel (meshed); all values for one pixel are specified before values for the next pixel.
Grayscale windows store pixel data in planar configuration; color windows store it in meshed configuration. NSDrawBitmap
can render meshed data in a planar window, or planar data in a meshed window. However, it’s more efficient if the image has a depth (bitsPerSample) and configuration (isPlanar) that match the window.
The hasAlpha argument indicates whether the image contains alpha. If it does, the number of samples should be 1 greater than the number of color components in the model (for example, 4 for RGB).
The colorSpace argument can be NSCustomColorSpace
, indicating that the image data is to be interpreted according to the current color space in the graphics state. This allows for imaging using custom color spaces. The image parameters supplied as the other arguments should match what the color space is expecting.
If the image data is planar, data[0] through data[samplesPerPixel–1] point to the planes; if the data is meshed, only data[0] needs to be set.
NSGraphics.h
Draws a gray-filled rectangle representing a user-interface button.
void NSDrawButton ( NSRect aRect, NSRect clipRect );
The bounding rectangle (in the current coordinate system) in which to draw. Only those parts of aRect that lie within the clipRect are actually drawn.
The clipping rectangle to use during drawing.
Draws a gray-filled rectangle, used to signify a user-interface button. Since this function is often used to draw the border of a view, the aRect parameter typically contains the view’s bounds rectangle. For an Aqua button, use an NSButton
object instead.
This function fills the specified rectangle with light gray. This function is designed for rectangles that are defined in unscaled, unrotated coordinate systems (that is, where the y axis is vertical, the x axis is horizontal, and a unit along either axis is equal to 1 screen pixel). The coordinate system can be either flipped or unflipped. The sides of the rectangle should lie on pixel boundaries.
NSGraphics.h
Draws a colored bordered rectangle.
NSRect NSDrawColorTiledRects ( NSRect boundsRect, NSRect clipRect, const NSRectEdge *sides, NSColor **colors, NSInteger count );
The bounding rectangle (in the current coordinate system) in which to draw. Since this function is often used to draw the border of a view, this rectangle will typically be that view’s bounds rectangle. Only those parts of boundsRect that lie within the clipRect are actually drawn.
The clipping rectangle to use during drawing.
The sides of the rectangle for which you want to specify custom colors. Each side must have a corresponding entry in the colors parameter.
The colors to draw for each of the edges listed in the sides parameter.
The number of 1.0-unit-wide slices to draw on the specified sides.
The rectangle that lies within the resulting border.
Behaves the same as NSDrawTiledRects
except it draws its border using colors from the colors array.
NSGraphics.h
Draws a dark gray-filled rectangle with a bezel border.
void NSDrawDarkBezel ( NSRect aRect, NSRect clipRect );
The bounding rectangle (in the current coordinate system) in which to draw. Only those parts of aRect that lie within the clipRect are actually drawn.
The clipping rectangle to use during drawing.
NSGraphics.h
Draws a gray-filled rectangle with a bezel border.
void NSDrawGrayBezel ( NSRect aRect, NSRect clipRect );
The bounding rectangle (in the current coordinate system) in which to draw. Only those parts of aRect that lie within the clipRect are actually drawn.
The clipping rectangle to use during drawing.
NSGraphics.h
Draws a gray-filled rectangle with a groove border.
void NSDrawGroove ( NSRect aRect, NSRect clipRect );
The bounding rectangle (in the current coordinate system) in which to draw. Only those parts of aRect that lie within the clipRect are actually drawn.
The clipping rectangle to use during drawing.
NSGraphics.h
Draws a white-filled rectangle with a bezel border.
void NSDrawLightBezel ( NSRect aRect, NSRect clipRect );
The bounding rectangle (in the current coordinate system) in which to draw. Only those parts of aRect that lie within the clipRect are actually drawn.
The clipping rectangle to use during drawing.
NSGraphics.h
Draws a nine-part tiled image.
void NSDrawNinePartImage(NSRect frame, NSImage *topLeftCorner, NSImage *topEdgeFill, NSImage *topRightCorner, NSImage *leftEdgeFill, NSImage *centerFill, NSImage *rightEdgeFill, NSImage *bottomLeftCorner, NSImage *bottomEdgeFill, NSImage *bottomRightCorner, NSCompositingOperation op, CGFloat alphaFraction, BOOL flipped );
The rectangle (specified in the current coordinate system) in which to draw the images.
The image to display in the top-left corner.
The image used to tile the space between the topLeftCorner and topRightCorner images.
The image to display in the top-right corner.
The image used to tile the space between the topLeftCorner and bottomLeftCorner images.
The image used to tile the center area between the other eight images.
The image used to tile the space between the topRightCorner and bottomRightCorner images.
The image to display in the bottom-left corner.
The image used to tile the space between the bottomLeftCorner and bottomRightCorner images.
The image to display in the bottom-right corner.
The compositing operation to use when rendering the images.
The alpha value to apply to the rendered image. This value can range between 0.0 and 1.0, with 0.0 being fully transparent and 1.0 being fully opaque.
Specify YES
if you are drawing the images in a flipped coordinate system; otherwise, specify NO
.
This function is typically used to draw custom cells that are capable of being resized both vertically and horizontally. Cells of this type are comprised of four fixed-size corner images along and a set of edge and center images that are used to fill the gaps between the corners. These cells allow you to create sophisticated looking controls that can grow and shrink in any direction without distorting the control’s overall appearance.
You should prefer the use of this function over your own custom code for handling multi-part images whose size can change. This function correctly manages the subtle behaviors needed to handle resolution independence issues and to avoid visual artifacts caused by tiling the various images.
This function uses the top-left and bottom-right corner images to determine the widths and heights of the edge areas that need to be filled. If the width or height of the bottom-left and top-right images are not sized appropriately, they may be scaled to fill their corner area. Edge areas between the corners are tiled using the corresponding image. Similarly, the center area is tiled using the specified center image.
The flipped parameter lets you reorient the contents of each image when drawing in a flipped coordinate system. By default, images use an internal coordinate system that is not flipped. Rendering such an image in a flipped coordinate system would therefore cause the image to appear upside down. Passing YES
for the flipped parameter adjusts the image’s internal coordinate system to draw it correctly in a flipped environment.
NSCell.h
Draws a three-part tiled image.
void NSDrawThreePartImage(NSRect frame, NSImage *startCap, NSImage *centerFill, NSImage *endCap, BOOL vertical, NSCompositingOperation op, CGFloat alphaFraction, BOOL flipped );
The rectangle (specified in the current coordinate system) in which to draw the images.
For a horizontal three-part image, this is the image located at the left edge of the frame rectangle. For a vertical three-part image, this image appears at the top of the screen in an unflipped coordinate system and at the bottom of the screen in a flipped coordinate system.
The image used to tile the space between the startCap and endCap images.
For a horizontal three-part image, this is the image located at the right edge of the frame rectangle. For a vertical three-part image, this image appears at the bottom of the screen in an unflipped coordinate system and at the top of the screen in a flipped coordinate system.
Specify YES
if the images should be stacked on top of one another to create a vertically oriented element. Specify NO
if the images should be laid out side-by-side to create a horizontally oriented element.
The compositing operation to use when rendering the images.
The alpha value to apply to the rendered image. This value can range between 0.0 and 1.0, with 0.0 being fully transparent and 1.0 being fully opaque.
Specify YES
if you are drawing the images in a flipped coordinate system; otherwise, specify NO
.
This function is typically used to draw custom cells (such as the backgrounds for push button and slider controls) that are capable of being resized along a single axis only. Cells of this type are comprised of fixed-size end cap images and a center area that is filled by tiling the specified center image as many times as needed to fill the gap. These cells allow you to create sophisticated looking controls that can grow and shrink without distorting the control’s overall appearance.
You should prefer the use of this function over your own custom code for handling multi-part images whose size can change. This function correctly manages the subtle behaviors needed to handle resolution independence issues and to avoid visual artifacts caused by tiling the various images.
When drawing a horizontally oriented control, the images in the startCap, centerFill, and endCap parameters should all have the same height, and that height should match the height of the frame rectangle. If an image’s height does not match the height of the frame rectangle, it is scaled until it does match, which might yield less desirable results. For vertically oriented controls, the image widths are scaled instead of the heights.
The flipped parameter lets you reorient the contents of each image when drawing in a flipped coordinate system. By default, images use an internal coordinate system that is not flipped. Rendering such an image in a flipped coordinate system would therefore cause the image to appear upside down. Passing YES
for the flipped parameter adjusts the image’s internal coordinate system to draw it correctly in a flipped environment.
NSCell.h
Draws rectangles with borders.
NSRect NSDrawTiledRects ( NSRect boundsRect, NSRect clipRect, const NSRectEdge *sides, const CGFloat *grays, NSInteger count );
The bounding rectangle (in the current coordinate system) in which to draw. Since this function is often used to draw the border of a view, this rectangle will typically be that view’s bounds rectangle. Only those parts of boundsRect that lie within the clipRect are actually drawn.
The clipping rectangle to use during drawing.
The sides of the rectangle for which you want to specify custom gray levels. Each side must have a corresponding entry in the grays parameter.
The gray levels to draw for each of the edges listed in the sides parameter.
The number of 1.0-unit-wide slices to draw on the specified sides.
The rectangle that lies within the resulting border.
This is a generic function that can be used to draw different types of borders inside a given rectangle. These borders can be used to outline an area or to give rectangles the effect of being recessed from or elevated above the surface of the screen.
The sides, grays, and count parameters determine how thick the border is and what gray levels are used to form it. This function uses the NSDivideRect
function to take successive 1.0-unit-wide slices from the sides of the rectangle specified by the sides parameter. Each slice is drawn using the corresponding gray level from the grays parameter. This function makes and draws these slices count number of times. If you specify the same side more than once, the second slice is drawn inside the first.
The following example uses this function to draw a bezeled border consisting of a 1.0–unit-wide white line at the top and on the left side and a 1.0-unit-wide dark-gray line inside a 1.0–unit-wide black line on the other two sides. The resulting rectangle inside this border is then filled in using light gray.
NSRectEdge mySides[] = {NSMinYEdge, NSMaxXEdge, NSMaxYEdge, NSMinXEdge, |
NSMinYEdge, NSMaxXEdge}; |
float myGrays[] = {NSBlack, NSBlack, NSWhite, NSWhite, |
NSDarkGray, NSDarkGray}; |
NSRect aRect, clipRect; // Assume exists |
aRect = NSDrawTiledRects(aRect, clipRect, mySides, myGrays, 6); |
[[NSColor grayColor] set]; |
NSRectFill(aRect); |
In the preceding example, mySides is an array that specifies sides of a rectangle; for example, NSMinYEdge
selects the side parallel to the x axis with the smallest y coordinate value. myGrays is an array that specifies the successive gray levels to be used in drawing parts of the border.
NSGraphics.h
Draws a white-filled rectangle with a bezel border.
void NSDrawWhiteBezel ( NSRect aRect, NSRect clipRect );
The bounding rectangle (in the current coordinate system) in which to draw. Only those parts of aRect that lie within the clipRect are actually drawn.
The clipping rectangle to use during drawing.
NSGraphics.h
Draws the window’s default background pattern into the specified rectangle of the currently focused view.
void NSDrawWindowBackground ( NSRect aRect );
The rectangle (in the current coordinate system) in which to draw the window’s background pattern.
NSGraphics.h
Enables screen updates
void NSEnableScreenUpdates (void);
Reenables, for all windows of a process, the flushing of drawing operations to the screen that was previously disabled by NSDisableScreenUpdates
. Successive calls to NSDisableScreenUpdates
are placed on a stack and must be popped off that stack by matching calls to this function.
NSGraphics.h
Erases the specified rect by filling it with white.
void NSEraseRect ( NSRect aRect );
The rectangle (in the current coordinate system) defining the area to erase.
This function fills the specified rectangle with white. It does not alter the current color.
NSGraphics.h
Returns the event mask for the specified type.
static NSUInteger NSEventMaskFromType ( NSEventType type );
The event type whose mask you want to get.
The event mask corresponding to the specified type. The returned mask is equivalent to the number 1 left-shifted by type bits.
NSEvent.h
Draw a bordered rectangle.
void NSFrameRect ( NSRect aRect );
The bounding rectangle (in the current coordinate system) in which to draw.
Draws a frame around the inside of aRect in the current color and using the NSCompositeCopy
compositing operation. The width is equal to 1.0 in the current coordinate system. Since the frame is drawn inside the rectangle, it will be visible even if drawing is clipped to the rectangle.
Because this function does not draw directly on the line, but rather inside it, it uses the current fill color (not stroke color) when drawing.
For a list of compositing operations and how you use them, see Cocoa Drawing Guide.
NSGraphics.h
Draw a bordered rectangle.
void NSFrameRectWithWidth ( NSRect aRect, CGFloat frameWidth );
The bounding rectangle (in the current coordinate system) in which to draw.
The width of the frame, specified in points.
Draws a frame around the inside of aRect in the current color and using the NSCompositeCopy
compositing operation. The width is equal to frameWidth in the current coordinate system. Since the frame is drawn inside the rectangle, it will be visible even if drawing is clipped to the rectangle.
Because this function does not draw directly on the line, but rather inside it, it uses the current fill color (not stroke color) when drawing.
For a list of compositing operations and how you use them, see Cocoa Drawing Guide.
NSGraphics.h
Draw a bordered rectangle using the specified compositing operation.
void NSFrameRectWithWidthUsingOperation ( NSRect aRect, CGFloat frameWidth, NSCompositingOperation op );
The bounding rectangle (in the current coordinate system) in which to draw.
The width of the frame, specified in points.
The compositing operation to use when drawing the frame.
Draws a frame around the inside of aRect in the current color, using the compositing operation op. The width is equal to frameWidth in the current coordinate system. Since the frame is drawn inside the rectangle, it will be visible even if drawing is clipped to the rectangle.
Because this function does not draw directly on the line, but rather inside it, it uses the current fill color (not stroke color) when drawing.
For a list of compositing operations and how you use them, see Cocoa Drawing Guide.
NSGraphics.h
Returns an alert panel.
id NSGetAlertPanel ( NSString *title, NSString *msg, NSString *defaultButton, NSString *alternateButton, NSString *otherButton, ... );
Returns an NSPanel
that can be used to set up a modal session. A modal session is useful for allowing the user to interrupt the program. During a modal session, you can perform activities while the panel is displayed and check at various points in your program whether the user has clicked one of the panel’s buttons. The arguments for this function are the same as those for NSRunAlertPanel
, but unlike that function, no button is displayed if defaultButton is nil
.
To set up a modal session, send the Application object beginModalSessionForWindow:
with the panel returned by NSGetAlertPanel
as its argument. When you want to check if the user has clicked one of the panel’s buttons, use runModalSession:
. To end the modal session, use endModalSession:
. When you’re finished with the panel created by NSGetAlertPanel
, you must free it by passing it to NSReleaseAlertPanel
.
NSPanel.h
Returns an alert panel to display a critical message.
id NSGetCriticalAlertPanel ( NSString *title, NSString *msg, NSString *defaultButton, NSString *alternateButton, NSString *otherButton, ... );
Returns an NSPanel
that can be used to set up a modal session. No button is displayed if defaultButton is nil
. When you’re finished with the panel created by this function, you must free it by passing it to NSReleaseAlertPanel
.
The arguments for this function are the same as those for the NSGetAlertPanel
. For more information on using a panel in a modal session, see NSGetAlertPanel
.
The panel presented to the user is badged with a caution icon. Critical alerts should be used only as specified in the "Alerts” section of the Windows chapter of Apple Human Interface Guidelines.
NSPanel.h
Returns a file type based on the passed pasteboard type.
NSString * NSGetFileType ( NSString *pboardType );
This function is the inverse of both NSCreateFileContentsPboardType
and NSCreateFilenamePboardType
. When passed a pasteboard type as returned by those functions, it returns the extension or filename from which the type was derived. It returns nil
if pboardType isn’t a pasteboard type created by those functions.
NSPasteboard.h
Returns an array of file types based on the passed pasteboard types.
NSArray * NSGetFileTypes ( NSArray *pboardTypes );
Accepts a null-terminated array of pointers to pasteboard types and returns a null-terminated array of the unique extensions and filenames from the file content and filename types found in the input array. It returns nil
if the input array contains no file content or filename types. The returned array is allocated and must be freed by the caller. The pointers in the return array point into strings passed in the input array.
NSPasteboard.h
Returns an alert panel to display an informational message.
id NSGetInformationalAlertPanel ( NSString *title, NSString *msg, NSString *defaultButton, NSString *alternateButton, NSString *otherButton, ... );
Returns an NSPanel that can be used to set up a modal session. No button is displayed if defaultButton is nil
. When you’re finished with the panel created by this function, you must free it by passing it to NSReleaseAlertPanel
.
The arguments for this function are the same as those for the NSRunAlertPanel
function. For more information on using a panel in a modal session, see NSGetAlertPanel
.
NSPanel.h
Returns the amount of memory being used by a context.
NSInteger NSGetWindowServerMemory ( NSInteger context, NSInteger *virtualMemory, NSInteger *windowBackingMemory, NSString **windowDumpString );
Calculates the amount of memory being used at the moment by the given context. If NULL
is passed for context, the current context is used. The amount of virtual memory used by the current context is returned in the int pointed to by virtualMemory; the amount of window backing store used by windows owned by the current context is returned in the int pointed to by windowBackingMemory. The sum of these two numbers is the amount of the memory that this context is responsible for.
Calculating these numbers takes some time to execute; thus, calling this function in normal operation is not recommended.
If nil
is not passed in for windowDumpStream, the information returned is echoed to the specified stream. This fact can be useful for finding out more about which windows are using up your storage.
Normally, NSGetWindowServerMemory
returns 0. If NULL
is passed for context and there’s no current display context, this function returns –1.
NSGraphics.h
Highlights the specified rect by filling it with white.
void NSHighlightRect ( NSRect aRect );
The bounding rectangle (in the current coordinate system) in which to draw.
Highlights the rectangle referred to by aRect. Light gray becomes white, and white becomes light gray. This function must be called twice, once to highlight the rectangle and once to unhighlight it; the rectangle should not be left in its highlighted state. When not drawing on the screen, the compositing operation is replaced by one that fills the rectangle with light gray.
NSGraphics.h
Returns an interface style value for the specified key and responder.
NSInterfaceStyle NSInterfaceStyleForKey ( NSString *key, NSResponder *responder );
Used to determine an interface style based on a key and a responder, either of which may be nil
. An NSInterfaceStyle
value specifies the style in which an interface item, such as a button or a scroll bar, should be drawn. For example, a value of NSMacintoshInterfaceStyle
indicates an item should be drawn in the Macintosh style. The values defined for NSInterfaceStyle
are NSNoInterfaceStyle
, NSNextStepInterfaceStyle
, NSWindows95InterfaceStyle
, and NSMacintoshInterfaceStyle
. Note that this function never returns NSNoInterfaceStyle
.
The interface style value returned by this function depends on several factors. If responder is not nil
and if responder specifies an interface style other than NSNoInterfaceStyle
, this function returns the responder’s style, and key is ignored.
Otherwise, if key is not nil
and there is an interface style for key specified by the defaults system, this function returns the interface style for key from the defaults system.
Finally, if key is nil
, or if there is no interface style for key specified by the defaults system, this function returns the global interface style specified by the defaults system.
The defaults system allows an application to customize its behavior to match a user’s preferences. You can read about the defaults system in the documentation for NSUserDefaults
.
NSInterfaceStyle.h
Tests whether a given object is special marker object used for indicating the state of a selection in relation to a key.
BOOL NSIsControllerMarker ( id object );
Specify the object you want to check. This parameter can be nil
.
YES
if the object is one of the designated controller markers or NO
if it is not.
This function helps you to create bindings between user interface elements and controller objects. The Application Kit predefines several special marker objects used as values for indicating selection state; currently these are NSMultipleValuesMarker
, NSNoSelectionMarker
, and NSNotApplicableMarker
. These markers are typed as id
and only exist for the purpose of indicating a state; they are never archived and cannot be used as object values in controls. You use this function to test whether a given object value is a marker, in which case it is not directly assignable to the object that is bound. This check is important, especially since additional markers may be added in the future.
See the NSKeyValueBinding.h
header file for further details.
NSKeyValueBinding.h
Returns the number of color components in the specified color space.
NSInteger NSNumberOfColorComponents ( NSString *colorSpaceName );
Returns the number of color components in the color space whose name is provided by colorSpaceName
.
NSGraphics.h
Returns global OpenGL options.
void NSOpenGLGetOption ( NSOpenGLGlobalOption pname, GLint *param );
Returns in param the value of the global OpenGL parameter pname. The available options are enumerated by the NSOpenGLGlobalOption
type.
NSOpenGL.h
Returns the NSOpenGL version numbers.
void NSOpenGLGetVersion ( GLint *major, GLint *minor );
Returns by reference the major and minor version numbers of the NSOpenGL implementation. This function is not the same as the OpenGL version.
NSOpenGL.h
Sets global OpenGL options.
void NSOpenGLSetOption ( NSOpenGLGlobalOption pname, GLint param );
Sets the value of the global OpenGL parameter pname to param. The available options are enumerated by the NSOpenGLGlobalOption
type.
NSOpenGL.h
Programmatically invokes a Services menu service.
BOOL NSPerformService ( NSString *itemName, NSPasteboard *pboard );
Specifies a Services menu item, in any language. If the requested service is from a submenu of the Services menu, the value must contain a slash (for example, “Mail/Selection”).
The pasteboard containing the data required by the service. This data must be present for the service to succeed. On output, this pasteboard contains the data returned by the service provider.
YES
if the service was successfully performed or NO
if it was not.
Use this function to programmatically invoke a service found in the application’s Services menu.
NSApplication.h
Returns whether the specified window depth is planar.
BOOL NSPlanarFromDepth ( NSWindowDepth depth );
Returns YES
if the specified window depth is planar and NO
if it is not.
NSGraphics.h
Reads the color of the pixel at the specified location.
NSColor * NSReadPixel ( NSPoint passedPoint );
The pixel location to read, specified in the current coordinate system.
The color of the pixel at the specified location.
Because the passedPoint parameter is relative to the current coordinate system, if you wish to read a pixel from a specific view, you must convert points in the view’s coordinate system to the current coordinate system before calling this function. Alternatively, you can lock focus on the view and then specify the pixel coordinate in the view’s coordinate system.
When mapping the specified point to pixel boundaries, this method rounds to the nearest pixel. For more information on how coordinate points map to the underlying pixels, see Coordinate Systems and Transforms in Cocoa Drawing Guide.
NSGraphics.h
Modifies the current clipping path by intersecting it with the passed rect.
void NSRectClip ( NSRect aRect );
The rectangle to intersect with the current clipping rectangle.
This function modifies the clipping path permanently. If you need to undo this modification later, you should save the current graphics state before calling this function and restore it once you are done.
A side effect of this function is that it clears the current Quartz 2D drawing path information. If you used Quartz 2D functions to create a drawing path in the current context, and you want to save that path information and use it later, you should transfer it to a CGPathRef
opaque type before calling this function. If you are using only Cocoa to do your drawing, this behavior should not affect you.
NSGraphics.h
Modifies the current clipping path by intersecting it with the passed rect.
void NSRectClipList ( const NSRect *rects, NSInteger count );
A pointer to an array of NSRect
structures, which are combined and intersected with the current clipping path.
The number of rectangles in rects.
This function modifies the clipping path permanently by generating a graphical union of the specified rectangles and then intersecting that union with the current clipping path. If you need to undo this modification later, you should save the current graphics state before calling this function and restore it once you are done.
A side effect of this function is that it clears the current Quartz 2D drawing path information. If you used Quartz 2D functions to create a drawing path in the current context, and you want to save that path information and use it later, you should transfer it to a CGPathRef
opaque type before calling this function. If you are using only Cocoa to do your drawing, this behavior should not affect you.
NSGraphics.h
Fills the passed rectangle with the current color.
void NSRectFill ( NSRect aRect );
The bounding rectangle (in the current coordinate system) in which to draw.
Fills aRect with the current color using the compositing mode NSCompositeCopy
, which fills with the current color by copying the RGBA values. Use NSRectFillUsingOperation
to fill specifying a compositing mode.
For a list of compositing operations and how you use them, see Cocoa Drawing Guide.
NSGraphics.h
Fills the rectangles in the passed list with the current fill color.
void NSRectFillList ( const NSRect *rects, NSInteger count );
A pointer to an array of NSRect
structures representing the rectangles to fill.
The number of rectangles in rects.
Fills the specified rectangles with the current fill color using the compositing mode NSCompositeCopy
.
For a list of compositing operations and how you use them, see Cocoa Drawing Guide.
NSGraphics.h
Fills the rectangles in a list using the current fill color and specified compositing operation.
void NSRectFillListUsingOperation ( const NSRect *rects, NSInteger count, NSCompositingOperation op );
A pointer to an array of NSRect
structures representing the rectangles to fill.
The number of rectangles in the rects parameter.
The compositing operation to use when filling the rectangles.
Fills a list of count rectangles with the current fill color, using the compositing operation op. For example, specifying NSCompositeSourceOver
will blend with what's already been drawn.
For a list of compositing operations and how you use them, see Cocoa Drawing Guide.
NSGraphics.h
Fills the rectangles in the passed list with the passed list of colors.
void NSRectFillListWithColors ( const NSRect *rects, NSColor **colors, NSInteger num );
A pointer to an array of NSRect
structures representing the rectangles to fill.
A pointer to an array of NSColor
objects. The number of color objects in this parameter must equal the number of rectangles in the rects parameter.
The number of rectangles in the rects parameter.
Takes a list of num rectangles and a matching list of color objects. The first rectangle is filled with the first color, the second rectangle with the second color, and so on. There must be an equal number of rectangles and color values. The rectangles are composited using the NSCompositeCopy
operator and the order in which the rectangles are filled cannot be guaranteed; therefore, overlapping rectangles may not draw as expected. This function alters the current color of the current graphics state, setting it unpredictably to one of the values passed in colors.
For a list of compositing operations and how you use them, see Cocoa Drawing Guide.
NSGraphics.h
Fills the rectangles in a list using the specified colors and compositing operation.
void NSRectFillListWithColorsUsingOperation ( const NSRect *rects, NSColor **colors, NSInteger num, NSCompositingOperation op );
A pointer to an array of NSRect
structures representing the rectangles to fill.
A pointer to an array of NSColor
objects. The number of color objects in this parameter must equal the number of rectangles in the rects parameter.
The number of rectangles in the rects parameter.
The compositing operation to use when filling the rectangles.
Takes a list of num rectangles and a matching list of color values. The first rectangle is filled with the first color, the second rectangle with the second color, and so on. There must be an equal number of rectangles and color values. Each fill operation is performed using the compositing operation op. The rectangles should not overlap; the order in which they are filled cannot be guaranteed. This function alters the current color of the current graphics state, setting it unpredictably to one of the values passed in colors.
For a list of compositing operations and how you use them, see Cocoa Drawing Guide.
NSGraphics.h
Fills the rectangles in the passed list with the passed list of grays.
void NSRectFillListWithGrays ( const NSRect *rects, const CGFloat *grays, NSInteger num );
A pointer to an array of NSRect
structures representing the rectangles to fill.
A pointer to an array of floating-point values in the range 0.0 to 1.0, where 0.0 represents absolute black and 1.0 represents absolute white and numbers in between are varying levels of gray. Values outside this range are clamped to 0.0 or 1.0.
The number of rectangles in the rects parameter.
Takes a list of num rectangles and a matching list of gray values. The first rectangle is filled with the first gray, the second rectangle with the second gray, and so on. There must be an equal number of rectangles and gray values. The rectangles are composited using the NSCompositeCopy
operator and the order in which the rectangles are filled cannot be guaranteed; therefore, overlapping rectangles may not draw as expected. This function alters the current color of the current graphics state, setting it unpredictably to one of the values passed in grays.
For a list of compositing operations and how you use them, see Cocoa Drawing Guide.
NSGraphics.h
Fills a rectangle using the current fill color and the specified compositing operation.
void NSRectFillUsingOperation ( NSRect aRect, NSCompositingOperation op );
The rectangle to fill with the current fill color.
The compositing operation to use when filling the rectangle.
For a list of compositing operations and how you use them, see Cocoa Drawing Guide.
NSGraphics.h
Registers a service provider.
void NSRegisterServicesProvider ( id provider, NSString *name );
The object providing the service you want to register.
The unique name to associate with the service. This string is used to advertise the service to interested clients.
Use this function to register custom services not directly related to your application.
You should not use this function to register the services provided by your application. For your application’s services, you should use the setServicesProvider:
method of NSApplication
, passing a non-nil
argument.
NSApplication.h
Releases an alert panel.
void NSReleaseAlertPanel ( id panel );
When you’re finished with a panel created by a function such as NSGetAlertPanel
, NSGetCriticalAlertPanel
, or NSGetInformationalAlertPanel
, you must free it by passing it to this function.
Note that the alert panel may not be deallocated immediately because it may have internal references that are released in a deferred way. You should not make the assumption that the alert panel is immediately removed from the application window list.
NSPanel.h
Creates an alert panel.
NSInteger NSRunAlertPanel ( NSString *title, NSString *msg, NSString *defaultButton, NSString *alternateButton, NSString *otherButton, ... );
Creates and runs an alert panel (or dialog) with the title of title, the text of msg, and buttons with titles of defaultButton, alternateButton, and otherButton. See the description of NSBeginAlertSheet
for information on layout of buttons, default parameters, and possible return values. NSRunAlertPanel
runs the panel in a modal event loop.
A Command-D key equivalent for the “Don’t Save” button is provided, if one is found. The button titles are searched for the localized value for “Don’t Save.” If a match is found, that button is assigned a Command-D key equivalent, provided it is not the default button.
If you create a modal panel using runModalForWindow:
or beginSheet:modalForWindow:modalDelegate:didEndSelector:contextInfo:
, you can assign the key equivalent yourself, using setKeyEquivalent:
and setKeyEquivalentModifierMask:
.
This function not only creates the panel; it also puts the panel onscreen and runs it using the runModalForWindow:
method defined in the NSApplication
class. This method sets up a modal event loop that causes the panel to remain onscreen until the user clicks one of its buttons. This function then removes the panel from the screen list and returns a value that indicates which of the three buttons the user clicked. For efficiency, this function creates the panel the first time it’s called and reuses it on subsequent calls, reconfiguring it if necessary.
NSPanel.h
Creates and runs a critical alert panel.
NSInteger NSRunCriticalAlertPanel ( NSString *title, NSString *msg, NSString *defaultButton, NSString *alternateButton, NSString *otherButton, ... );
Creates a critical alert panel that warns the user of some critical consequence of a requested action; the panel lets the user cancel the action and may allow the user to modify the action. It then runs the panel in a modal event loop.
The panel presented to the user is badged with a caution icon. Critical alerts should be used only as specified in the "Alerts” section of the Windows chapter of Apple Human Interface Guidelines.
The arguments for this function are the same as those for NSRunAlertPanel
.
NSPanel.h
Creates and runs an informational alert panel.
NSInteger NSRunInformationalAlertPanel ( NSString *title, NSString *msg, NSString *defaultButton, NSString *alternateButton, NSString *otherButton, ... );
Creates an informational alert panel that provides information related to a requested action. It then runs the panel in a modal event loop.
The arguments for this function are the same as those for NSRunAlertPanel
.
NSPanel.h
Specifies how a focus ring will be drawn.
void NSSetFocusRingStyle ( NSFocusRingPlacement placement );
Specifies how you want the focus ring to be drawn.
Use NSFocusRingAbove
to draw the focus ring over an image, use NSFocusRingBelow
to draw the focus ring under text, and use NSFocusRingOnly
if you don’t have an image or text. For the NSFocusRingOnly
case, fills a shape to add the focus ring around the shape.
Note that the focus ring may actually be drawn outside the view but will be clipped to any clipping superview or the window content view.
NSGraphics.h
Specifies whether an item should be included in Services menus.
NSInteger NSSetShowsServicesMenuItem ( NSString *itemName, BOOL enabled );
Deprecated. This function simply returns 0.
NSApplication.h
Runs a system animation effect.
void NSShowAnimationEffect ( NSAnimationEffect animationEffect, NSPoint centerLocation, NSSize size, id animationDelegate, SEL didEndSelector, void *contextInfo );
The type of animation you want to apply.
The location at which to show the animated image, specified in screen coordinates. The animation is centered on the point you specify.
The desired size of the animated image. Specify NSZeroSize
to perform the animation at the default size.
The object to notify when the animation completes. Specify nil
if you do not need to be notified when the animation completes.
The selector of animationDelegate to call when the animation completes. Specify nil
if you do not need to be notified when the animation completes. If you specify a selector, the corresponding method should have the following signature:
- (void)animationEffectDidEnd:(void *)contextInfo; |
A pointer to any optional information you want passed as a parameter to the selector in the didEndSelector parameter.
This function runs one of the standard system animation effects, which includes display and sound. For example, you can use this function to display the puff of smoke effect. For a complete list of animation effects, see NSAnimationEffect
.
NSGraphics.h
Specifies whether a Services menu item is currently enabled.
BOOL NSShowsServicesMenuItem ( NSString *itemName );
Deprecated. This function simply returns YES
.
NSApplication.h
Unregisters a service provider.
void NSUnregisterServicesProvider(NSString *name);
The name of the service you want to unregister.
Use this function to unregister custom services not directly related to your application.
You should not use this function to unregister the services provided by your application. For your application’s services, you should use the setServicesProvider:
method of NSApplication
, passing a nil
argument.
NSApplication.h
Causes the services information for the system to be updated.
void NSUpdateDynamicServices (void);
Used by a service-providing application to reregister the services it is willing to provide. To do this, you create a bundle with the extension “.service
” and place it in the application’s path or ~/Library/Services
. The content of the bundle is identical to a normal service bundle. You then call this function.
It is only necessary to call this function if your program adds dynamic services to the system.
NSApplication.h
Gets information about onscreen windows.
void NSWindowList ( NSInteger size, NSInteger list[] );
Provides an ordered list of all onscreen windows. It fills list with up to size window numbers; the order of windows in the array is the same as their order in the window server’s screen list (their front-to-back order on the screen). Use the count obtained by NSCountWindows
to specify the size of the array for this function.
NSGraphics.h
Gets information about an application’s onscreen windows.
void NSWindowListForContext ( NSInteger context, NSInteger size, NSInteger list[] );
Provides an ordered list of onscreen windows for a particular application, identified by context, which is a window server connection ID. It fills list with up to size window numbers; the order of windows in the array is the same as their order in the window server’s screen list (their front-to-back order on the screen). Use the count obtained by the NSCountWindowsForContext
function to specify the size of the array for this function.
Use of this function is discouraged as it may be deprecated in a future release.
NSGraphics.h
© 2008 Apple Inc. All Rights Reserved. (Last updated: 2008-11-19)